#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
struct point {
  int x, y;
} a[maxn];
int n, tot;
inline void dfs(int l, int r) {
  if (l >= r) return;
  int mid = (l + r) >> 1;
  int x = a[mid].x;
  for (int i = l; i <= r; i++) {
    n++;
    a[n].x = x;
    a[n].y = a[i].y;
  }
  dfs(l, mid), dfs(mid + 1, r);
}
inline bool cmp(const point &aa, const point &bb) {
  if (aa.x != bb.x) return aa.x < bb.x;
  return aa.y < bb.y;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y);
  sort(a + 1, a + n + 1, cmp);
  dfs(1, n);
  sort(a + 1, a + n + 1, cmp);
  int ans = 1;
  for (int i = 2; i <= n; i++)
    if (a[i].x != a[i - 1].x || a[i].y != a[i - 1].y) ans++;
  printf("%d\n", ans);
  printf("%d %d\n", a[1].x, a[1].y);
  for (int i = 2; i <= n; i++)
    if (a[i].x != a[i - 1].x || a[i].y != a[i - 1].y) {
      printf("%d %d\n", a[i].x, a[i].y);
    }
  return 0;
}
