N = int(input()) A = [] B = [] for i in range(N) : greeting = list(map(str,input().split())) for j in range(N) : if greeting[j] == "nyanpass" : A.append(j+1) if len(A) == 0 : print(-1) else : for k in range(len(A)) : b = A.count(k+1) B.append(b) if len(B) == 1 : print(B[0]) else : print(-1)