N, M = map(int, input().split()) count = 0 for i in range(N): S, R = input().split() R = int(R) if R >= 1200 and not (S[0] == S[1] == S[2] == S[3] == "o"): count += 1 print(count)