integer N
logical,allocatable,dimension(:,:)::Black
character(500) S
logical Bexist

integer Gyo,Retsu
integer C
logical FLAW

integer x,prex
read*,N
allocate(Black(N,N))
Black=.false.
Bexist=.false.
do i=1,N
  read*,S
  do j=1,N
    if(S(j:j)=="#")then
      Black(i,j)=.TRUE.
      Bexist=.TRUE.
    endif
  end do
end do

if(.not.Bexist)then
  print"(i0)",-1
  stop
endif

C=0
do Retsu=1,N
  FLAW=.FALSE.
  do j=1,N
    FLAW=FLAW.or.(.not.Black(j,Retsu))
  end do
  if(FLAW)C=C+1
end do

x=huge(x)
do Gyo=1,N
  Bexist=.FALSE.
  do i=1,N
    if(Black(i,Gyo))Bexist=.TRUE.
  end do
  prex=0
  do i=1,N
    if(.not.Black(Gyo,i))prex=prex+1
  end do
  if(.not.Bexist)prex=prex+1

  x=min(x,prex)
end do

print"(i0)",x+c

end