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