#include <iostream>
using namespace std;
bool isjl(double t, int c)
{
return t >= 37.5 && c;
}
int main()
{
int n, c;
double t;
string s;
cin >> n;
int ans = 0;
while (n--)
{
cin >> s >> t >> c;
if (isjl(t, c))
{
cout << s << endl;
ans++;
}
}
cout << ans;
return 0;
}