#include <bits/stdc++.h>
using namespace std;
const double eps = 1.0e-11;
const double pi = acos(-1.0);
int main() {
  int n;
  scanf("%d", &n);
  set<int> a, b;
  int x, y;
  for (long long i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    a.insert(x), b.insert(y);
  }
  cout << min(a.size(), b.size()) << endl;
  return 0;
}
