N, M = map(int, input().split()) ans = 0 for _ in range(N): s, r = input().split() if int(r) < 1200: continue ans += "x" in s[:4] print(ans)