N, M = map(int, input().split()) ans = 0 for i in range(N): S, r = input().split() if int(r) < 1200: continue if S[:4] != "oooo": ans += 1 print(ans)