s='#';n,*a=open(0).readlines();n=int(n);f=sum(n==t.count(s)for t in zip(*a));r=list(range(n));print((-all(not s in t for t in a)or min(n*2-f-a[i].count(s)+all(s<a[j][i]for j in r)for i in r)))
n,*a=open(0).readlines();n=int(n);*b,=list(zip(*a));f,e=[sum(n==t.count(c)for t in b)for c in'#.'];print((-(e==n)or min(n*2-f-a[i].count('#')+(not'#'in b[i])for i in range(n))))
s = "#"
n, *a = open(0).readlines()
n = int(n)
f = sum(n == t.count(s) for t in zip(*a))
r = list(range(n))
print(
    (
        -all(not s in t for t in a)
        or min(n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in r) for i in r)
    )
)

n, *a = open(0).readlines()
n = int(n)
(*b,) = list(zip(*a))
f, e = [sum(n == t.count(c) for t in b) for c in "#."]
print(
    (
        -(e == n)
        or min(n * 2 - f - a[i].count("#") + (not "#" in b[i]) for i in range(n))
    )
)

-s = "#" -f = sum(n == t.count(s) for t in zip(*a)) -r = list(range(n)) +(*b,) = list(zip(*a)) +f, e = [sum(n == t.count(c) for t in b) for c in "#."] -        -all(not s in t for t in a) -        or min(n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in r) for i in r) +        -(e == n) +        or min(n * 2 - f - a[i].count("#") + (not "#" in b[i]) for i in range(n))