#include #include #include #include using namespace std; int main() { int N,ans = 1; cin >> N; vector s(N); vector win_num(N, 0); for (int i = 0; i < N;i++) { cin >> s[i]; for (int j = 0; j < N;j++) { if (i == j) { continue; } if (s[i][j] == 'o') { win_num[i]++; } } } for (int i = 0; i < N;i++) { for (int j = 0; j < N;j++) { if (i == j) { continue; } if (s[i][j] == '-') { if (i == 0) {win_num[i]++; s[i][j] = 'o'; s[j][i] = 'x';} else { if (win_num[i] < win_num[j]) { win_num[i]++; s[i][j] = 'o'; s[j][i] = 'x'; } else { win_num[j]++; s[i][j] = 'x'; s[j][i] = 'o'; } } } } } int win_0 = win_num[0],temp,count = 0; sort(win_num.begin(), win_num.end()); temp = win_num[N - 1]; for (int i = N - 1; i >= 0;i--) { if (win_num[i] < temp) { ans++; } if (win_num[i] == temp) { count++; } if (count == N - 2 && win_num[1] - win_num[0] == 1) { cout << 2 << endl; return 0; } if (win_num[i] == win_0) { cout << ans << endl; return 0; } temp = win_num[i]; } return 0; }