#!/usr/bin/env python3 #fileencoding: utf-8 N = int(input()) mat = [[j for j in input().strip().split(" ")] for i in range(N)] ren = -1 for i,v in enumerate(zip(*mat)): tmp = list(set([j for j in v if j != "-"])) if len(tmp) == 1 and tmp[0] == "nyanpass": if ren == -1: ren = i + 1 else: ren = -1 break print(ren)