#include #include #include #include #include using namespace std; typedef long long ll; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) int N; int maxrank = 6; string sv[6]; void check(){ set s; int w = 0; REP(i,N){ int win = 0; REP(j,N){ if(sv[i][j] == 'o') win++; } if(i == 0) w = win; else s.insert(win); } int rank = 1; for(auto it = s.rbegin(); it != s.rend(); ++it){ if(*it > w) rank++; else break; } maxrank = min(maxrank, rank); } void dfs(int i, int j){ if(j == N) return dfs(i+1,0); if(i == N){ check(); return; } if(sv[i][j] != '-') return dfs(i,j+1); sv[i][j] = 'o'; sv[j][i] = 'x'; dfs(i,j+1); sv[i][j] = sv[j][i] = '-'; } int main(){ cin >> N; REP(i,N) cin >> sv[i]; REP(i,N){ if(sv[0][i] == '-'){ sv[0][i] = 'o'; sv[i][0] = 'x'; } } dfs(0,0); cout << maxrank << endl; return 0; }