#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  sort(a, a + n);
  sort(b, b + n);
  int t1 = 1, t2 = 1;
  for (i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      t1++;
    }
    if (b[i] != b[i - 1]) {
      t2++;
    }
  }
  printf("%d\n", min(t1, t2));
  return 0;
}
