#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  std::set<int, greater<int>> st1;
  std::set<int, greater<int>> st2;
  short x{0}, y{0};
  int test{0};
  cin >> test;
  while (test--) {
    cin >> x >> y;
    st1.insert(x);
    st2.insert(y);
  }
  cout << min(st1.size(), st2.size()) << '\n';
  return 0;
}
