#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int t = 0;
pair<int, int> l[maxn], a[maxn];
void superset(int c, int r) {
  int k = (r + c) / 2;
  for (int i = c; i < r; i++) {
    a[t].first = l[k].first;
    a[t].second = l[i].second;
    t++;
  }
  if (r - c > 1) {
    superset(c, k);
    superset(k, r);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i].first >> l[i].second;
  }
  sort(l, l + n);
  superset(0, n);
  for (int i = 0; i < n; i++) {
    a[t].first = l[i].first;
    a[t].second = l[i].second;
    t++;
  }
  sort(a, a + t);
  t = unique(a, a + t) - a;
  cout << t << endl;
  for (int i = 0; i < t; i++) {
    cout << a[i].first << " " << a[i].second << endl;
  }
}
