#include "bits/stdc++.h" #define REP(i,a,b) for(int i=a;i> a;}; template void reader(T& t,U& u){reader(t); reader(u);} template void reader(T& t,U& u,V& v){reader(t); reader(u); reader(v);} void writer(int a,char c) {printf("%d",a); putchar(c);} void writer(ll a,char c) {printf("%lld",a); putchar(c);} void writer(double a,char c) {printf("%.20lf",a); putchar(c);} void writer(char a[]) {printf("%s",a);}; void writer(char a[],char c) {printf("%s",a);putchar(c);}; void writer(char a,char c) {putchar(a); putchar(c);}; templatevoid writerLn(T t){writer(t,'\n');} templatevoid writerLn(T t,U u){writer(t,' ');writer(u,'\n');} template void writerLn(T t,U u,V v){writer(t,' ');writer(u,' ');writer(v,'\n');} template void writerArr(T x[], int n){int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');} template void writerVec(vector x){int n=x.size();int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');} int dx[] = { 0,1,0,-1 }; int dy[] = { 1,0,-1,0 }; // #define int ll int n; bool test = 1; void dfs(int& ans,char s[][7],int a ,vector& win) { REP(i,a,n) { REP(j,i+1,n) { if(s[i][j] == '-') { s[i][j] = '!'; win[i]++; dfs(ans,s,i,win); win[i]--; win[j]++; dfs(ans,s,i,win); win[j]--; s[i][j] = '-'; return; } } } int rank = 1; vector tmp = win; sort(ALL(tmp),greater()); rep(i,n) { if(i) { if(tmp[i] != tmp[i-1]) rank++; } if(tmp[i] == win[0]) break; } if(rank < ans) ans = rank; } //............................ #define MAX 300000 signed main(){ int i,j,k,l; cin >> n; char s[6][7]; rep(i,n) cin >> s[i]; vector win(6); REP(i,1,n) { if(s[0][i] != 'x') win[0] += 1; else win[i] += 1; } int ans = 100; int a = 1; REP(i,1,n) { REP(j,i+1,n) { if(s[i][j] == 'o') win[i] += 1; if(s[i][j] == 'x') win[j] += 1; } } dfs(ans,s,a,win); cout << ans << endl; return 0; }