#include <bits/stdc++.h>
using namespace std;
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
int main() {
  int n;
  cin >> n;
  map<int, int> x;
  map<int, int> y;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    x[a]++;
    y[b]++;
  }
  cout << min(x.size(), y.size()) << endl;
  return 0;
}
