#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int x[n], y[n];
  int i = 0, j = 0;
  for (i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  sort(x, x + n);
  sort(y, y + n);
  int c1 = 1, c2 = 1;
  for (i = 0; i < n - 1; i++) {
    if (x[i] < x[i + 1]) {
      c1++;
    }
    if (y[i] < y[i + 1]) {
      c2++;
    }
  }
  cout << min(c1, c2);
}
