#include <bits/stdc++.h>
int main() {
  int x[101] = {};
  int y[101] = {};
  int jumlah;
  int result;
  int vert = 0, horz = 0;
  scanf("%d", &jumlah);
  for (int i = 0; i < jumlah; i++) {
    int inpX, inpY;
    scanf("%d %d", &inpX, &inpY);
    if (x[inpX] == 0) {
      horz++;
    }
    x[inpX]++;
    if (y[inpY] == 0) {
      vert++;
    }
    y[inpY]++;
  }
  if (vert && horz) {
    if (vert < horz) {
      result = vert;
    } else {
      result = horz;
    }
  } else if (horz) {
    result = horz;
  } else if (vert) {
    result = vert;
  } else {
    result = 0;
  }
  printf("%d\n", result);
}
