N,M=list(map(int,input().split())) ans=0 for i in range(N): s,r=list(map(str,input().split())) if int(r)>=1200 and s[:4]!="oooo": ans+=1 print(ans)