import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

immutable long MOD = 998244353;

void main() {
    auto N = readln.chomp.to!int;
    auto A = iota(N).map!(_ => readln.chomp.map!(s => s == '#').array).array;

    int cols = N.iota.map!(j => N.iota.map!(i => A[i][j]).sum == N).sum;

    auto ok = new bool[](N);
    foreach (i; 0..N) foreach (j; 0..N) if (A[i][j]) ok[j]  = true;

    int solve(int r) {
        if (!ok[r]) return 1 << 29;
        else return N - A[r].sum;
    }

    int ans = N.iota.map!(i => solve(i)).reduce!min;
    if (ans == 1 << 29) writeln(-1);
    else writeln(ans + N - cols);
}