#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int N = 2e5 + 10;
set<pair<int, int> > s;
pair<int, int> a[N];
void solve(int l, int r) {
  if (l > r) return;
  int mid = l + r >> 1;
  for (int i = l; i <= r; i++) s.insert(make_pair(a[mid].first, a[i].second));
  solve(l, mid - 1), solve(mid + 1, r);
}
signed main() {
  int n = read();
  for (int i = 1; i <= n; i++) {
    int x = read(), y = read();
    a[i] = make_pair(x, y);
    s.insert(a[i]);
  }
  sort(a + 1, a + n + 1);
  solve(1, n);
  cout << s.size() << endl;
  for (auto v : s) cout << v.first << ' ' << v.second << endl;
}
