n = int(input()) S = [list(input()) for _ in range(n)] win = 0 for j in range(1, n): if S[0][j] == "-": S[0][j] = "o" S[j][0] = "x" if S[0][j] == "o": win += 1 lst = [] for i in range(1, n): for j in range(i + 1, n): if S[i][j] == "-": lst.append((i, j)) ans = n l = len(lst) for bit in range(1 << l): for i in range(l): if bit >> i & 1: S[lst[i][0]][lst[i][1]] = "o" S[lst[i][1]][lst[i][0]] = "x" se = {win} for i in range(1, n): tot = 0 for j in range(n): if S[i][j] == "o": tot += 1 se.add(tot) ls = sorted(se, reverse = True) ans = min(ans, ls.index(win) + 1) print(ans)