n = int(input()) LS = [] for i in range(n): LS.append(input().split()) num = 0 N = n for i in range(n): cnt = 0 for j in range(N): if LS[j][i] == 'nyanpass': cnt += 1 if cnt == n-1: num += 1 if num == 1: print("1") else: print(-1)