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