amaou=["akai","marui","okii","umai"] amaou.sort() n=int(input()) a=0 for i in range(n): s=input().split() s.sort() a+=s==amaou print(a)