import java.util.Scanner; public class Main_yukicoder239 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[][] a = new String[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { a[i][j] = sc.next(); } } int ret = -1; for (int i = 0; i < n; i++) { boolean flag = true; for (int j = 0; j < n; j++) { if (j != i && !a[j][i].equals("nyanpass")) { flag = false; break; } } if (flag && ret == -1) { ret = i + 1; } else if (flag && ret != -1) { ret = -1; break; } } System.out.println(ret); sc.close(); } }