#include using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) string a[300][300]; int main(){ int n;cin>>n; rep(i,n)rep(j,n) cin>>a[i][j]; int cnt=0,m=-1; rep(j,n) { bool ok=1; rep(i,n) if(a[i][j]!="nyanpass")ok=0; if(ok)cnt++,m=j; } cout<<(cnt==1 ?m:-1) <