c = 0 for _ in range(int(input())): c += len(set(input().split())&{"akai","marui","okii","umai"})==4 print(c)