#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int v[n], h[n], i;
  for (i = 0; i < n; i++) cin >> v[i] >> h[i];
  sort(v, v + n);
  sort(h, h + n);
  long long int cv = 1, ch = 1;
  for (i = 1; i < n; i++) {
    if (v[i] == v[i - 1]) continue;
    cv++;
  }
  for (i = 1; i < n; i++) {
    if (h[i] == h[i - 1]) continue;
    ch++;
  }
  if (cv >= ch)
    cout << ch;
  else
    cout << cv;
  return 0;
}
