#include <bits/stdc++.h>
using namespace std;
int x, y, n, i, x_state[2019], y_state[2019], ans, sum_x, sum_y;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x >> y;
    if (!x_state[x]) sum_x++;
    if (!y_state[y]) sum_y++;
    x_state[x] = 1, y_state[y] = 1;
  }
  if (sum_x > sum_y) {
    ans = sum_y;
  } else
    ans = sum_x;
  cout << ans;
  return 0;
}
