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