_,*s=open(0).readlines() a=0 for i in s:a+=set(i.split())=={'umai','marui','okii','akai'} print(a)