#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int main() {
  int n;
  cin >> n;
  set<int> x, y;
  for (int i = 0; i < n; i++) {
    int xx, yy;
    cin >> xx >> yy;
    x.insert(xx);
    y.insert(yy);
  }
  cout << min(x.size(), y.size()) << "\n";
}
