import java.util.*; class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String[][] a = new String[n][n]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { a[i][j] = in.next(); } } String target = "nyanpass"; int ans = 0; int count = 0; for(int j = 0; j < n; j++) { boolean flag = true; for(int i = 0; i < n; i++) { if(a[i][j].equals(target)) continue; else if(a[i][j].equals("-")) continue; else flag = false; } if(flag) { ans = j + 1; count++; } } if(count == 1) System.out.println(ans); else System.out.println(-1); } }