#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > res;
vector<pair<int, int> > a;
void solve(int l, int r) {
  if (r - l < 1) return;
  int m = (l + r) / 2;
  for (int i = (l); i < (r + 1); ++i)
    res.insert(make_pair(a[m].first, a[i].second));
  solve(l, m);
  solve(m + 1, r);
}
int main() {
  int n;
  scanf("%d", &n);
  a.resize(n);
  for (int i = (0); i < (n); ++i) scanf("%d%d", &a[i].first, &a[i].second);
  sort(a.begin(), a.end());
  for (int i = (0); i < (n); ++i) res.insert(a[i]);
  solve(0, n - 1);
  printf("%d\n", res.size());
  set<pair<int, int> >::iterator it;
  for (it = res.begin(); it != res.end(); ++it)
    printf("%d %d\n", it->first, it->second);
  return 0;
}
