#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> arr1[n], arr2[n];
  for (int i = 0; i < n; i++) {
    cin >> arr1[i].first >> arr1[i].second;
    arr2[i].first = arr1[i].second;
    arr2[i].second = arr2[i].first;
  }
  sort(arr1, arr1 + n);
  sort(arr2, arr2 + n);
  int c1 = 1, c2 = 1;
  for (int i = 0; i < n - 1; i++) {
    if (arr1[i].first - arr1[i + 1].first != 0) c1++;
  }
  for (int i = 0; i < n - 1; i++) {
    if (arr2[i].first - arr2[i + 1].first != 0) c2++;
  }
  if (c1 < c2)
    cout << c1 << endl;
  else
    cout << c2 << endl;
  return 0;
}
