S = input
R = range
P = print
def I(): return int(S())
def M(): return map(int, S().split())
def L(): return list(M())
def O(): return list(map(int, open(0).read().split()))
def yn(b): print("Yes" if b else "No")
biga = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
smaa = "abcdefghijklmnopqrstuvwxyz"

ans = 0
for _ in R(I()):
	s = list(S().split())
	s.sort()
	if s == ["akai", "marui", "okii", "umai"]:
		ans += 1
print(ans)