#include <bits/stdc++.h>
using namespace std;
set<pair<int, int>> s;
pair<int, int> point[10100];
void work(int l, int r) {
  if (r == l) return;
  int m = (l + r) >> 1;
  for (int i = l; i < r; i++) {
    s.insert(make_pair(point[m].first, point[i].second));
  }
  work(l, m);
  work(m + 1, r);
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> point[i].first >> point[i].second;
    s.insert(point[i]);
  }
  sort(point, point + t);
  work(0, t);
  cout << s.size() << endl;
  for (set<pair<int, int>>::iterator it = s.begin(); it != s.end(); it++) {
    cout << it->first << " " << it->second << endl;
  }
  return 0;
}
