N = int(input()) ans = 0 A = sorted(['akai','marui','okii','umai']) for i in range(N): S = sorted(input().split(' ')) if A == S: ans += 1 print(ans)