#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
const int MAX = 11000;
const int inf = 999999999;
const int p1 = 104393321, p2 = 104393329;
set<pair<int, int> > S;
pair<int, int> p[MAX];
void F(int f, int s) {
  if (f + 1 == s) return;
  int mid = (f + s) / 2;
  for (int i = (f); i < int(s); ++i)
    S.insert(pair<int, int>(p[mid].first, p[i].second));
  F(f, mid);
  F(mid, s);
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = (0); i < int(n); ++i) {
    cin >> p[i].first >> p[i].second;
    S.insert(p[i]);
  }
  sort(p, p + n);
  F(0, n);
  cout << S.size() << endl;
  for (__typeof((S).begin()) i = (S).begin(); i != (S).end(); ++i) {
    cout << i->first << " " << i->second << endl;
  }
  return 0;
}
