#include #include using namespace std; char s[11][11]; int x[11], y[11], c = 0; int main(void) { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%s", s[i]); for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { if (s[i][j] == '-') { x[c] = j; y[c] = i; c += 1; } } } int res = 111; for (int i = 0; i < 1<>j&1) ? 'o' : 'x'; s[x[j]][y[j]] = (i>>j&1) ? 'x' : 'o'; } int pts[11]{}; bool cnt[11]{}; for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { if (s[j][k] == 'o') pts[j] += 1; } } int r = 0; for (int i = 1; i < n; i++) { if (!cnt[pts[i]] && pts[i] > pts[0]) { cnt[pts[i]] = 1; r++; } } res = min(res, r+1); } printf("%d\n", res); return 0; }