#include <bits/stdc++.h>
using namespace std;
long long arr[100009], brr[100009];
int main() {
  long long n, a = 0, b = 0;
  cin >> n;
  while (n--) {
    long long x, y;
    cin >> x >> y;
    if (!arr[x]) {
      a++;
      arr[x] = 1;
    }
    if (!brr[y]) {
      b++;
      brr[y] = 1;
    }
  }
  cout << min(a, b);
  return 0;
}
