import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
int n;
void main(){
	n = readln.chomp.to!int;
	bool[][] xss;
	foreach(i; 0 .. n){
		xss ~= readln.chomp.map!(x => (x == '#')).array;
		}
	
	int donecolumncount = 0;
	foreach(j; 0 .. n){
		bool f = 1;
		foreach(i; 0 .. n){
			if(!xss[i][j]) f = 0;
			}
		if(f) donecolumncount += 1;
		}
	
	int cmin = n + 1;
	foreach(i; 0 .. n){
		int c = 0;
		foreach(j; 0 .. n){
			if(!xss[i][j]){
				c += 1;
				if(i == j){
					int f = 1;
					foreach(ii; 0 .. n){
						if(xss[ii][j]) f = 0;
						}
					c += f;
					}
				}
			
			}
		if(c < cmin) cmin = c;
		}
	
	int ans;
	if(cmin > n) ans = -1;
	else ans = cmin + n - donecolumncount;
	
	ans.writeln;
	
	}
