import itertools N = int(input()) S = [list(input()) for _ in range(N)] count = 0 for s in S: for m in s: if m == '-': count += 1 rg = count//2 WL = ('o','x') rup = [] for pat in itertools.product(WL, repeat=rg): p = list(pat) CS = [x[:] for x in S] wn = [] for j in range(N): for k in range(N): if CS[j][k] == '-': wl = p.pop() if wl == 'o': CS[j][k] = 'o' CS[k][j] = 'x' else: CS[j][k] = 'x' CS[k][j] = 'o' for cs in CS: w = cs.count('o') wn.append(w) tw = wn[0] swn = list(set(wn)) wn = sorted(swn, reverse=True) rank = wn.index(tw) + 1 rup.append(rank) print(min(rup))