N = int(input()) s = [[x for x in input()] for _ in range(N)] a = [i for i,x in enumerate(s[0]) if x == '-'] s[0] = [x if x != '-' else 'o' for x in s[0]] for i in range(1,N): s[i][0] = s[i][0] if s[i][0] != '-' else 'x' for i in range(1,N): if s[i].count('o') > s[0].count('o'): s[i] = [x if x != '-' else 'o' for x in s[i]] for j in range(N): s[j][i] = s[j][i] if s[j][i] != '-' else 'x' for c in range(N): for i in range(1, N): if s[i].count('o') == c and '-' in s[i]: j = s[i].index('-') s[i][j] = 'o' s[j][i] = 'x' wc0 = [x.count('o') for x in s] for i in a: if wc0[0] < wc0[i] and wc0[i] + 1 in wc0: s[0][i] = 'x' s[i][0] = 'o' wc = [x.count('o') for x in s] on = [] ans = 1 for i in range(1, N): if wc[i] > wc[0] and not wc[i] in on: on.append(wc[i]) ans += 1 print(ans)