#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[10005];
set<pair<int, int> > s;
void dfs(int l, int r) {
  if (l == r) return;
  int i, mid = (l + r) >> 1;
  for (i = l; i <= r; i++) s.insert(make_pair(p[mid].first, p[i].second));
  dfs(l, mid);
  dfs(mid + 1, r);
}
int main() {
  int m, n, i, j, k;
  cin >> m;
  for (i = 0; i <= m - 1; i++) cin >> p[i].first >> p[i].second, s.insert(p[i]);
  sort(p, p + m);
  dfs(0, m - 1);
  cout << s.size() << endl;
  for (set<pair<int, int> >::iterator it = s.begin(); it != s.end(); it++) {
    cout << (*it).first << ' ' << (*it).second << endl;
  }
}
