S = ["akai","marui","okii","umai"] S.sort() N = int(input()) ans = 0 for _ in range(N): T = input.split() T.sort() for i in range(4): if T[i] != S[i]: break else: ans += 1 print(ans)