#include <iostream>
#include <vector>
#include <algorithm>

#define SHOWMTRX(a){printf("---"#a"---\n");for(int i=0;i<n;++i){for(int j=0;j<n;++j){printf("%4d",a[i][j]);}printf("\n");}printf("----\n");}
#define SHOWARRY(a){printf("---"#a"---\n");for(int i=0;i<n;++i){printf("%4d\n",a[i]);}printf("----\n");}
int main() {
	//std::ios::sync_with_stdio(false);
	//std::cin.tie(0);

	int n;
	std::cin >> n;
	std::vector<std::vector<int>> s(n, std::vector<int>(n));
	std::vector<std::vector<int>> evaluation(n, std::vector<int>(n));
	std::vector<int> point(n, 0);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			char c;
			std::cin >> c;
			switch (c) {
			case '#': s[i][j] = 99; break;
			case 'o': s[i][j] =  1; break;
			case 'x': s[i][j] = -1; break;
			case '-': s[i][j] =  0; break;
			}
		}
	}SHOWMTRX(s);
	for (int i = 0; i < n; ++i) {
		if (s[0][i] == 0) {
			s[0][i] = 1;
			s[i][0] = -1;
		}
	}SHOWMTRX(s);
	for (int i = 0; i < n; ++i) {
		int sum = 0;
		for (int j = 0; j < n; ++j) {
			if (s[i][j] == 99) continue;
			sum += s[i][j];
		}
		point[i] = sum;
	}SHOWARRY(point);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (s[i][j] != 0) evaluation[i][j] = -99;
			else              evaluation[i][j] = point[i];
		}
	}SHOWMTRX(evaluation);
	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			if (evaluation[i][j] == -99) continue;
			int tmp = evaluation[j][i];
			evaluation[j][i] -= evaluation[i][j];
			evaluation[i][j] -= tmp;
			evaluation[i][j] *= -1;
			evaluation[j][i] *= -1;
		}
	}SHOWMTRX(evaluation);
	bool flag;
	do {
		flag = false;
		int max = -99, maxI, maxJ;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (max < evaluation[i][j]) {
					max = evaluation[i][j];
					maxI = i;
					maxJ = j;
					flag = true;
				}
			}
		}
		if (flag) {
			evaluation[maxI][maxJ] = -99;
			evaluation[maxJ][maxI] = -99;
			s[maxI][maxJ] = 1;
			s[maxJ][maxI] = -1;
		}
	} while (flag); SHOWMTRX(s);
	for (int i = 0; i < n; ++i) {
		int sum = 0;
		for (int j = 0; j < n; ++j) {
			if (s[i][j] == 99) continue;
			sum += s[i][j];
		}
		point[i] = sum;
	}SHOWARRY(point);
	int pointZero = point[0];
	std::sort(point.begin(), point.end());
	std::reverse(point.begin(), point.end());
	std::vector<int> rank;
	for (int i = 0; i < n; ++i) {
		if (std::find(rank.begin(), rank.end(), point[i]) == rank.end()) {
			rank.push_back(point[i]);
		}
	}
	for (int i = 0; i < rank.size(); ++i) {
		if (rank[i] == pointZero) {
			std::cout << i + 1 << "\n";
			break;
		}
	}

	return 0;
}