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