pending = [] n = int(input()) s = [input() for _ in range(n)] for i in range(n): for j in range(i): if s[i][j] == '-': pending.append((i, j)) def calc_score(s): wincnt = [si.count('o') for si in s] t = wincnt[0] ret = 1 for x in set(wincnt): if x > t: ret += 1 return ret if not pending: print(calc_score(s)) exit(0) ans = n for b in range(1 << len(pending)): stmp = [list(si) for si in s] for k, (i, j) in enumerate(pending): if b >> k & 1: stmp[i][j] = 'o' else: stmp[j][i] = 'o' ans = min(ans, calc_score(stmp)) print(ans)