#include <bits/stdc++.h> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double> vd; typedef vector<vd> vvd; typedef vector<ll> vl; typedef vector<vl> vvl; typedef vector<string> vs; typedef vector<P> vp; typedef vector<vp> vvp; typedef vector<pll> vpll; typedef pair<int,P> pip; typedef vector<pip> vip; const int inf=1<<30; const ll INF=1ll<<60; const double pi=acos(-1); const double eps=1e-9; const ll mod=1e9+7; const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0}; int n; vvi a; vi b,c; int main(){ cin>>n; a=vvi(n,vi(n)); for(int i=0;i<n;i++) for(int j=0;j<n;j++){ char C; cin>>C; if(i<j){ if(C=='o') a[i][j]++; if(C=='x') a[i][j]--; if(i){ b.push_back(i); c.push_back(j); } } } int t=0,res=n,N=b.size(); for(int i=1;i<n;i++) if(a[0][i]>=0) t++; for(int i=0;i<1<<N;i++){ bool B=1; vi d(n); for(int j=0;j<N;j++){ if(i&1<<j&&a[b[j]][c[j]]==-1) B=0; if(!(i&1<<j)&&a[b[j]][c[j]]==1) B=0; if(i&1<<j) d[b[j]]++; else d[c[j]]++; } for(int j=1;j<n;j++) if(a[0][j]<0) d[j]++; if(!B) continue; int tmp=1; for(int j=1;j<n;j++) if(d[j]>t) tmp++; res=min(res,tmp); } cout<<res<<endl; }