#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100010;
pair<int, int> ps[MAX_N];
set<pair<int, int> > ans;
void solve(int l, int r) {
  if (l + 1 >= r) {
    return;
  }
  int mid = (l + r) / 2;
  for (int i = l; i < r; i++) {
    if (i != mid) {
      ans.insert(pair<int, int>{ps[mid].first, ps[i].second});
    }
  }
  solve(l, mid);
  solve(mid + 1, r);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ps[i].first >> ps[i].second;
    ans.insert(ps[i]);
  }
  sort(ps, ps + n);
  solve(0, n);
  cout << ans.size() << endl;
  for (const auto &p : ans) {
    cout << p.first << " " << p.second << endl;
  }
}
