N, M = map(int, input().split()) print(sum('x' in r and s >= 1200 for r,s in [(r[:4], int(s)) for r, s in [input().split() for _ in range(N)]]))