#include using namespace std; using pii = pair; int N; char B[10][10]; map mp; priority_queue Q; int main() { cin >> N; for (int i = 0; i < N; i++) { cin >> B[i]; mp[i] = 0; } int me = 0; for (int i = 0; i < N; i++) { if (B[0][i] == 'o') { me++; } if (B[0][i] == '-') { B[0][i] = 'o'; B[i][0] = 'x'; me++; } } int cnt = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { if (B[i][j] == 'o') mp[i]++; if (B[i][j] == '-') cnt++; } } cnt /= 2; while (cnt--) { int pos = 0, t = 1e8; for (auto x : mp) { if (x.first == 0) continue; if (x.second < t) { bool ok = false; for (int i = 0; i < N; i++) { if (B[x.first][i] == '-') { ok = true; B[x.first][i] = 'o'; B[i][x.first] = 'x'; } } if (ok) t = x.second, pos = x.first; } } mp[pos]++; } int ans = 0; set S; for (auto x : mp) { S.insert(x.second); // printf("%d, %d\n", x.first, x.second); } S.insert(me); // printf("me: %d\n", me);*/ int aa = 1; for (auto itr = S.rbegin(); itr != S.rend(); itr++) { if (*itr == me) { cout << aa << endl; return 0; } aa++; } return 0; }