L = ["akai","marui","okii","umai"] L.sort() N = int(input()) ans = 0 for i in range(N): if sorted(list(input().split())) == L: ans += 1 print(ans)