from copy import deepcopy N = int(input()) M = (N-1) * N // 2 s = [list(input()) for _ in range(N)] P = [] for i in range(1,N): for j in range(i): P.append((i,j)) ans = 100 for bit in range(2**M): S = deepcopy(s) x = bit for i in range(M): a,b = P[i] if S[a][b] != '-': pass elif x & 1: S[a][b] = 'o' S[b][a] = 'x' else: S[b][a] = 'o' S[a][b] = 'x' x >>= 1 cnt = [0] * N T = [] for i in range(N): for j in range(N): if S[i][j] == 'o': cnt[i] += 1 T.append(cnt[i]) T.sort(reverse=True) for i in range(N): if T[i] == cnt[0]: ans = min(ans, i+1) break print(ans)