#include <bits/stdc++.h>
using namespace std;
int one[100000], two[100000], o, t;
int main() {
  int a, l, r;
  scanf("%i", &a);
  for (int i = 0; i < a; i++) {
    scanf("%i", &l);
    scanf("%i", &r);
    if (one[l] == 0) {
      o++;
      one[l] = 1;
    }
    if (two[r] == 0) {
      t++;
      two[r] = 1;
    }
  }
  printf("%i", min(o, t));
  return 0;
}
