#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int x, y;
  bool operator<(const node &b) const { return x == b.x ? y < b.y : x < b.x; }
} a[10005];
set<node> s;
void dfs(int l, int r) {
  if (l == r) return;
  int mid = (l + r) >> 1;
  for (int i = l; i <= r; i++) s.insert((node){a[mid].x, a[i].y});
  dfs(l, mid);
  dfs(mid + 1, r);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    s.insert(a[i]);
  }
  sort(a + 1, a + n + 1);
  dfs(1, n);
  printf("%lu\n", s.size());
  for (set<node>::iterator it = s.begin(); it != s.end(); it++)
    printf("%d %d\n", it->x, it->y);
  return 0;
}
