#include <bits/stdc++.h>
using namespace std;
pair<int, int> p[10000];
vector<pair<int, int> > v;
void bs(int l, int r) {
  if (l + 1 >= r) return;
  int mid = (l + r) / 2;
  bs(l, mid);
  bs(mid, r);
  for (int i = l; i < r; ++i) {
    v.push_back(pair<int, int>(p[mid].first, p[i].second));
  }
}
int main() {
  int n, a, b, i;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; ++i) {
      scanf("%d%d", &p[i].first, &p[i].second);
      v.push_back(p[i]);
    }
    sort(p, p + n);
    bs(0, n);
    sort(v.begin(), v.end());
    (v).erase(unique(v.begin(), v.end()), v.end());
    printf("%d\n", v.size());
    for (i = 0; i < v.size(); ++i) {
      printf("%d %d\n", v[i].first, v[i].second);
    }
  }
  return 0;
}
