#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
int n;
pair<int, int> points[N];
set<pair<int, int> > ans;
set<pair<int, int> >::iterator it;
void solve(int l, int r) {
  if (r - l <= 1) return;
  int mid = (l + r) / 2;
  for (int i = l; i < r; i++) ans.insert({points[mid].first, points[i].second});
  solve(l, mid);
  solve(mid, r);
}
int main(int argc, const char* argv[]) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    points[i] = {x, y};
    ans.insert({x, y});
  }
  sort(points, points + n);
  solve(0, n);
  printf("%d\n", (int)ans.size());
  for (it = ans.begin(); it != ans.end(); it++) {
    printf("%d %d\n", it->first, it->second);
  }
  return 0;
}
