n=int(eval(input()));a=eval('list(input()),'*n);f=sum(n==t.count('#')for t in zip(*a));print((-all(t.count('#')<1for t in a)or min(n*2-f-a[i].count('#')+all(a[j][i]>'#'for j in range(n))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));print((-all(t.count(s)<1for t in a)or min(n*2-f-a[i].count(s)+all(s<a[j][i]for j in range(n))for i in range(n))))
n = int(eval(input()))
a = eval("list(input())," * n)
f = sum(n == t.count("#") for t in zip(*a))
print(
    (
        -all(t.count("#") < 1 for t in a)
        or min(
            n * 2 - f - a[i].count("#") + all(a[j][i] > "#" for j in range(n))
            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))
print(
    (
        -all(t.count(s) < 1 for t in a)
        or min(
            n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in range(n))
            for i in range(n)
        )
    )
)

-n = int(eval(input())) -a = eval("list(input())," * n) -f = sum(n == t.count("#") for t in zip(*a)) +s = "#" +n, *a = open(0).readlines() +n = int(n) +f = sum(n == t.count(s) for t in zip(*a)) -        -all(t.count("#") < 1 for t in a) +        -all(t.count(s) < 1 for t in a) -            n * 2 - f - a[i].count("#") + all(a[j][i] > "#" for j in range(n)) +            n * 2 - f - a[i].count(s) + all(s < a[j][i] for j in range(n))