#include <bits/stdc++.h>
using namespace std;
int a[111][111];
int con1, con2;
int main() {
  int i, j;
  int n;
  cin >> n;
  int x, y;
  for (i = 0; i < n; ++i) {
    cin >> x >> y;
    a[x][y] = 1;
  }
  for (i = 0; i <= 100; ++i)
    for (j = 0; j <= 100; ++j) {
      if (a[i][j]) {
        con1++;
        break;
      }
    }
  for (j = 0; j <= 100; ++j)
    for (i = 0; i <= 100; ++i) {
      if (a[i][j]) {
        con2++;
        break;
      }
    }
  cout << min(con1, con2) << endl;
}
