#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e4 + 10;
pair<int, int> A[MAX];
set<pair<int, int> > S;
void upd(int l, int h) {
  if (h - l == 1) return;
  int m = l + (h - l) / 2;
  for (int i = l; i < h; i++) S.insert(make_pair(A[m].first, A[i].second));
  upd(l, m);
  upd(m, h);
}
int32_t main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i].first >> A[i].second;
    S.insert(A[i]);
  }
  sort(A, A + n);
  upd(0, n);
  cout << S.size() << endl;
  for (auto x : S) cout << x.first << " " << x.second << endl;
}
