a,b=map(int, input().split()) x = 0 for i in range(a): z,w=input().split() if not z.startswith('oooo') and w >= 1200: x += 1 print(x)