n, m = map(int, input().split()) ans = 0 for i in range(n): s, r = input().split() ans += int(r) >= 1200 and s[:4].count('x') >= 1 print(ans)