a=int(input())
b=[]
c=0
d=["akai","marui","okii","umai"]
e=0
for i in range(a):
    b.append(list(input().split()))
for j in range(a):
    for i in d:
        if i in b[j]:
            c+=1
    if c==4:
        e+=1
    c=0
print(e)