#include<bits/stdc++.h>
using namespace std;
int main(){
long a,b,c,d,e,f,x;
cin >> a;
for(int i=0;i<a;i++){
cin >> b;
c = b / 1000;
d = (b - c*1000) / 100;
e = (b - c*1000 - d*100) / 10;
f = b - c*1000 - d*100 - e*10;
if(f-c-d-e > 0){
x += 1;
}
}
cout << x << endl;
return 0;
}