#include <bits/stdc++.h>
using namespace std;
struct node {
  int x, y;
  bool operator<(const node &t) const {
    if (x == t.x)
      return y < t.y;
    else
      return x < t.x;
  }
} a[10010];
int n;
set<node> _set;
void dfs(int l, int r) {
  if (l == r) return;
  int mid = (l + r) >> 1;
  node tmp;
  for (int i = l; i <= r; ++i) {
    tmp.x = a[mid].x;
    tmp.y = a[i].y;
    _set.insert(tmp);
  }
  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);
    _set.insert(a[i]);
  }
  sort(a + 1, a + 1 + n);
  dfs(1, n);
  printf("%d\n", _set.size());
  for (auto it : _set) printf("%d %d\n", it.x, it.y);
  return 0;
}
