#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
	int N;
	cin >> N;
	vector<string> s(N);
	vector<int> aw(N,0);
	for (int i = 0; i < N; i++) {
		cin >> s[i];
	}
	int c;
	int nb = 0;
	bool b = false;
	for (int j = 0; j < N; j++) {
		c = 0;
		for (int i = 0; i < N; i++) {
			if (s[i][j] == '#') {
				c++;
				b = true;
			}
		}
		if (c == 0) {
			aw[j] = 1;
		}
		else if (c == N) {
			nb++;
		}
	}
	
	if (!b) {
		cout << -1 << endl;
	}
	else {
		int k = 100000;
		for (int i = 0; i < N; i++) {
			c = 0;
			for (int j = 0; j < N; j++) {
				
				if (s[i][j] == '.') {
					c++;
				}
			}
			if (aw[i] == 1) {
				c++;
			}
			k = min(k, c);

		}
		//cerr << k << " " << nb << endl;
		cout << k + N - nb << endl;
	}

	return 0;
}