#include <iostream>
using namespace std;
int main()
{
int n, num;
cin >> n;
int c = 0;
while (n--)
{
cin >> num;
int g = num % 10;
int s = num % 100 / 10;
int b = num % 1000 / 100;
int q = num / 1000;
if (g - s - b - q > 0)
c++;
}
cout << c;
return 0;
}