n = int(input())
s = [input().strip() for _ in range(n)]

current_wins = [0] * n
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        if s[i][j] == 'o':
            current_wins[i] += 1

unplayed_0_matches = 0
for j in range(1, n):
    if s[0][j] == '-':
        unplayed_0_matches += 1
max_wins = current_wins[0] + unplayed_0_matches

matches = []
for i in range(1, n):
    for j in range(i + 1, n):
        if s[i][j] == '-':
            matches.append((i, j))

m = len(matches)
min_rank = float('inf')

from itertools import product

for bits in product([0, 1], repeat=m):
    added = [0] * n
    for k in range(m):
        i, j = matches[k]
        if bits[k]:
            added[i] += 1
        else:
            added[j] += 1

    wins = [0] * n
    wins[0] = max_wins
    for team in range(1, n):
        wins[team] = current_wins[team] + added[team]

    sorted_wins = sorted(wins, reverse=True)
    rank = None
    for idx in range(len(sorted_wins)):
        if sorted_wins[idx] == max_wins:
            rank = idx + 1
            break
    if rank < min_rank:
        min_rank = rank

print(min_rank)