#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
int n, cnt, ans = 1e9;
bool a[maxn + 10][maxn + 10];
char s[maxn + 10];
int main() {
	scanf("%d", &n);
	bool fd = 0;
	for (int i = 1; i <= n; ++i) {
		scanf("%s", s + 1);
		for (int j = 1; j <= n; ++j) {
			a[i][j] = s[j] == '#'; fd |= a[i][j];
		}
	}
	if (!fd) printf("-1");
	else {
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= n; ++j)
				if (!a[j][i]) {
					++cnt; break;
				}
		for (int i = 1; i <= n; ++i) {
			int now = cnt + 1;
			for (int j = 1; j <= n; ++j)
				now += !a[i][j];
			for (int j = 1; j <= n; ++j)
				if (a[j][i]) {
					--now; break;
				}
			ans = min(ans, now);
		}
		printf("%d", ans);
	}
}
