#include <iostream>
#include <set>
#define N_MAX 200000

using namespace std;

set<int> s1;set<int> s2;
set<int>::iterator it;
pair<set<int>::iterator, bool> redovi;
pair<set<int>::iterator, bool> kolone;

int brRedova[N_MAX], brKolona[N_MAX], ri[N_MAX], ci[N_MAX];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int N,maxRedova=0,maxKolona=0;
	cin >> N;
	for (int i = 0;i < N;i++) {
		cin >> ri[i] >> ci[i];
		redovi = s1.insert(ri[i]);
		if (redovi.second == true) brRedova[ri[i]] = 1;
		else
		{
			brRedova[ri[i]]++;
			if (brRedova[ri[i]] > maxRedova) maxRedova = brRedova[ri[i]];
		}
		kolone = s2.insert(ci[i]);
		if (kolone.second == true) brKolona[ci[i]] = 1;
		else
		{
			brKolona[ci[i]]++;
			if (brKolona[ci[i]] > maxKolona) maxKolona = brKolona[ci[i]];
		}
	}
	if (maxRedova == 0 && maxKolona == 0) cout << "0";
	else
	{
		if (maxRedova >= maxKolona) cout << maxRedova - 1;
		else cout << maxKolona - 1;
	}
}