#include <bits/stdc++.h>
using namespace std;
const int MAX = 10000;
int n;
set<pair<int, int> > a;
set<pair<int, int> >::iterator it;
pair<int, int> b[MAX];
void dive(int s, int e) {
  if (e - s == 1) return;
  int mid = s + e;
  mid /= 2;
  dive(s, mid);
  dive(mid, e);
  for (int i = s; i < e; i++) a.insert(make_pair(b[mid].first, b[i].second));
}
int main() {
  cin >> n;
  int x, y;
  for (int i = 0; i < n; i++) {
    cin >> b[i].first >> b[i].second;
    a.insert(b[i]);
  }
  sort(b, b + n);
  dive(0, n);
  cout << a.size() << endl;
  for (it = a.begin(); it != a.end(); it++)
    cout << it->first << ' ' << it->second << endl;
  return 0;
}
