#include <bits/stdc++.h>
using namespace std;

int main()
{
	bool f = true;
	int N;
	cin >> N;
	vector<vector<char>> a(N, vector<char>(N));
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> a[i][j];
			if (a[i][j] == '#') {
				f = false;
			}
		}
	}
	if (f) {
		cout << -1 << endl;
		return 0;
	}
	int lm = 0, r = 0;
	for (int i = 0; i < N; i++) {
		int cnt = 0;
		for (int j = 0; j < N; j++) {
			if (a[i][j] == '#') {
				cnt++;
			}
		}
		lm = max(lm, cnt);
	}
	for (int j = 0; j < N; j++) {
		bool flag = true;
		for (int i = 0; i < N; i++) {
			if (a[i][j] == '.') {
				flag = false;
				break;
			}
		}
		if (flag) {
			r++;
		}
	}
	if (lm == N) {
		cout << N - r << endl;
		return 0;
	}
	vector<int> ex(N);
	for (int j = 0; j < N; j++) {
		for (int i = 0; i < N; i++) {
			if (a[i][j] == '#') {
				ex[j] = 1;
				break;
			}
		}
	}
	int res = N;
	vector<int> need(N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (a[i][j] == '.') {
				need[i]++;
			}
		}
		need[i] += 1 - ex[i];
		res = min(res, need[i]);
	}
	cout << res + N - r << endl;
	return 0;
}
