"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var a = nexts(n,1);
  var ax = xArray(0,n);
  var ay = xArray(0,n);
  var ans = n;
  for(var y = 0; y < n; y++){
    for(var x = 0; x < n; x++){
      if(a[y][x] === "#"){
        ax[x]++, ay[y]++;
        if(ax[x] === n)ans--;
      }
    }
  }
  var id, mx = -1;
  for(var y = 0; y < n; y++){
    if(mx === ay[y])id.push(y);
    else if(mx < ay[y])mx = ay[y], id = [y];
  }
  if(mx === 0)return -1;
  ans += n-mx
  for(var i = 0; i < id.length; i++){
    var y = id[i];
    for(var x = 0; x < n; x++){
      if(a[x][y] === "#")return ans;
    }
  }
  return ans+1;
}