#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define ii pair<int,int>
#define INF 1000000000
#define M 1000000007ll
#define INFLL 1000000000000000010ll
#define UQ(x) (x).resize(distance((x).begin(),unique(all((x)))))
#define mid(x,y) (((x)+(y))>>1)

int n;
char g[505][505];
int a[505][505],row[505],cnt[505],col[505];
int main() {
	scanf("%d",&n);
	for (int i=0;i<n;i++) {
		scanf("%s",g[i]);
	}
	bool die=1;
	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) {
			a[i][j]=!!(g[i][j]=='#');
			if (a[i][j]) die=0,col[j]=1;
			cnt[i]+=a[i][j];
		}
	}
	if (die) {
		printf("-1\n");
		return 0;
	}
	for (int i=0;i<n;i++) {
		for (int j=0;j<n;j++) {
			if (a[i][j]) {
				bool has=0;
				for (int k=0;k<n;k++) {
					if (!a[k][j]) {
						has=1;
						break;
					}
				}
				if (has) row[i]++;
			} else row[i]++;
		}
	}
	int ans=INF;
	for (int i=0;i<n;i++) {
		if (col[i]) ans=min(ans,n-cnt[i]+row[i]);
		else ans=min(ans,n-cnt[i]+row[i]+1);
	}
	printf("%d\n", ans);
}