#include <iostream>
short int niz1[2*100000+1];
short int niz2[2*100000+1];
using namespace std;

int main()
{
    short int N;

    cin >> N;

    short int r, i, c;
    for(i=1;i<=N;i++)
    {
        cin>>r;
        cin>>c;
        niz1[r]++;
        niz2[c]++;


    }
    r=0;
    c=0;
    for(i=1;i<=N;i++)
    {

        if(niz2[i]==0) c++;
        if(niz1[i]==0) r++;
    }
    if (c>r) cout << c;
    else cout << r;




    return 0;
}