import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    def dfs(i=0, j=0):
        res = 10
        for ni in range(i, n):
            for nj in range(ni + 1, n):
                if ni == i and nj <= j: continue
                if t[ni][nj] == -1:
                    t[ni][nj] = 1
                    t[nj][ni] = 0
                    res = min(dfs(ni, nj), res)
                    t[ni][nj] = 0
                    t[nj][ni] = 1
                    res = min(dfs(ni, nj), res)
                    t[ni][nj] = -1
                    t[nj][ni] = -1
                    return res
        #p2D(t)
        #print()
        score = set(sum(tk) for tk in t)
        s0 = sum(t[0])
        for i, s in enumerate(sorted(score, reverse=True)):
            if s == s0: return i + 1

    n = int(input())
    t = [[(c == "o") * 1 - (c == "-") * 1 for c in input()] for _ in range(n)]
    print(dfs())

main()