#include <bits/stdc++.h>
using namespace std;
int n, cnt;
const int N = 200 * 1000;
pair<int, int> p[N];
void dv(int l, int r) {
  if (r - l <= 1) {
    return;
  }
  int m = (l + r) / 2;
  for (int i = l; i < r; i++) {
    p[cnt++] = make_pair(p[m].first, p[i].second);
  }
  dv(l, m);
  dv(m, r);
  return;
}
int main() {
  cin >> n;
  cnt = n;
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }
  sort(p, p + cnt);
  dv(0, n);
  sort(p, p + cnt);
  cnt = unique(p, p + cnt) - p;
  cout << cnt << endl;
  for (int i = 0; i < cnt; i++) {
    cout << p[i].first << " " << p[i].second << endl;
  }
  return 0;
}
