/*
B - Row to Column
http://mujin-pc-2017.contest.atcoder.jp/tasks/mujin_pc_2017_b
*/
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
	int N;
	cin >> N;
	string* field = new string[N];
	int* col_fill = new int[N];
	for (size_t i = 0; i < N; i++)
	{
		cin >> field[i];
		col_fill[i] = 0;
	}

	int* count = new int[N];
	for (int i = 0; i < N; i++)
	{
		count[i] = std::count(field[i].begin(), field[i].end(), '#');
		int pos = 0;
		while ((pos = field[i].find('#', pos)) != string::npos)
		{
			col_fill[pos]++;
			pos++;
		}	
	}

	int best;
	int max = -1;
	int filled = 0;
	for (int i = 0; i < N; i++)
	{
		if (count[i] - (col_fill[i] == 0) > max)
		{
			best == i;
			max = count[i] - (col_fill[i] == 0);
		}
		if (col_fill[i] == N)
			filled++;
	}

	if (max > -1)
	{
		int result = N - max + N - filled;
		cout << result;
	}
	else
		cout << -1;

	return 0;
}