#include using namespace std; #define REP(i,a,b) for(i=a;i'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);} void reader(int *x, int *y){reader(x);reader(y);} void reader(int *x, int *y, int *z){reader(x);reader(y);reader(z);} void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);} int reader(char c[]){int i,s=0;for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}c[s++]=i;for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}c[s]='\0';return s;} void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);} void writer(ll x, char c){int s=0,m=0;char f[20];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);} void writer(const char c[]){int i;for(i=0;c[i]!='\0';i++)mypc(c[i]);} int res = 1000; int N; char mp[100][100]; void solve(int a, int b){ int i, j, k, m; int cnt[10]; if(a==N){ rep(i,N) cnt[i] = 0; rep(i,N) rep(j,N) if(mp[i][j]=='o') cnt[i]++; k = 1; REP(i,1,N) if(cnt[0] < cnt[i]) k++; res = min(res, k); return; } if(b==N){ solve(a+1, 0); return; } if(mp[a][b]!='-'){ solve(a, b+1); return; } mp[a][b] = 'o'; mp[b][a] = 'x'; solve(a, b+1); mp[a][b] = 'x'; mp[b][a] = 'o'; solve(a, b+1); mp[a][b] = mp[b][a] = '-'; } int main(){ int i, j, k; reader(&N); rep(i,N) reader(mp[i]); solve(0,0); writer(res,'\n'); return 0; }