N,M = map(int,input().split()) ans = 0 for _ in range(M): S,R = input().split() R = int(R) if R >= 1200 and S[:4] != "oooo":ans += 1 print(ans)