#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500000;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
const long long int LLINF = 1e18 + 10;
int N;
int ptsn = 0;
pair<int, int> pts[MAXN];
void findAns(int l, int r) {
  if (l >= r) return;
  int m = (l + r + 1) / 2;
  findAns(l, m - 1);
  findAns(m, r);
  for (int i = l; i <= r; ++i) {
    pts[ptsn++] = make_pair(pts[m].first, pts[i].second);
  }
}
int main() {
  scanf("%d", &N);
  int xi, yi;
  for (int i = 0; i < N; ++i) {
    scanf("%d %d", &xi, &yi);
    pts[ptsn++] = make_pair(xi, yi);
  }
  sort(pts, pts + ptsn);
  findAns(0, ptsn - 1);
  sort(pts, pts + ptsn);
  int l = unique(pts, pts + ptsn) - pts;
  printf("%d\n", l);
  for (int i = 0; i < l; ++i) {
    printf("%d %d\n", pts[i].first, pts[i].second);
  }
  return 0;
}
