N, M = map(int, input().split()) ans = 0 for n in range(N): S, R = input().split() if int(R) >= 1200 and 'x' in S[:4]: ans += 1 print(ans)