#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[100 * 100 + 5];
pair<int, int> as[100 * 10000 + 5];
pair<int, int> ass[100 * 1000 * 7 + 5];
int p = 0;
int badbakhti(int l, int r) {
  if (r - l < 2) {
    return 1;
  }
  int h = -10000 * 100000, e = (r + l) / 2;
  h = a[e].first;
  for (int i = l; i < r; i++) {
    if (i != e) {
      as[p].first = a[e].first;
      as[p].second = a[i].second;
      p++;
    }
  }
  badbakhti(l, e);
  badbakhti(e, r);
  return 1;
}
int main() {
  int n;
  cin >> n;
  int d, q;
  for (int i = 0; i < n; i++) {
    cin >> d >> q;
    a[i] = make_pair(d, q);
    as[p] = make_pair(d, q);
    p++;
  }
  sort(a, a + n);
  badbakhti(0, n);
  sort(as, as + p);
  int u = 0, er = 0;
  for (int i = 0; i < p; i++) {
    u = i;
    while (as[i].first == as[u].first && as[i].second == as[u].second) u++;
    ass[er].first = as[i].first;
    ass[er].second = as[i].second;
    er++;
    i = u - 1;
  }
  cout << er << endl;
  for (int i = 0; i < er; i++) {
    cout << ass[i].first << " " << ass[i].second << endl;
  }
}
