N = int(input())
win = []

for i in range(N):
    row = list(input())
    win.append(row)

#for i in range(N):
#    if win[0][i] == "-":
#        win[0][i] = "o"
#        win[i][0] = "x"

#for i in range(N):print(*win[i], sep = "")
#print("***")

#win0 = win[0].count("o")

bitlength = 0
pos = []

for i in range(N):
    for j in range(i + 1, N):
        if win[i][j] == "-":
            pos.append([i, j])
            bitlength += 1
ans = 9
for b in range(2 ** bitlength):
    cmb = bin(b)[2:].zfill(bitlength)
    dmy = []
    for i in range(N):
        row = []
        for j in range(N):
            row.append(win[i][j])
        dmy.append(row)
    
    
    for i in range(bitlength):
        if cmb[i] == "0":
            dmy[pos[i][0]][pos[i][1]] = "x"
            dmy[pos[i][1]][pos[i][0]] = "o"
        else:
            dmy[pos[i][0]][pos[i][1]] = "o"
            dmy[pos[i][1]][pos[i][0]] = "x"
    
    win0 = win[0].count("o")
    winl = [win0]
    for i in range(1, N):
        winl.append(dmy[i].count("o"))
    #for i in range(N):print(*dmy[i], sep = "")
    #print("winl", winl)
    #print("***")
    winl = list(set(winl))
    winl = sorted(winl, reverse = True)
    ans = min(ans, winl.index(win0))

print(ans + 1)