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