#include <bits/stdc++.h>
using namespace std;
long long n;
struct point {
  long long x, y;
  point(long long a = 0, long long b = 0) : x(a), y(b) {}
  friend inline bool operator<(point a, point b) {
    return (a.x != b.x ? a.x < b.x : a.y < b.y);
  }
  friend inline bool operator==(point a, point b) {
    return a.x == b.x && a.y == b.y;
  }
} p[10001];
vector<point> ans;
void get_ans(long long l = 1, long long r = n) {
  if (l == r) return;
  long long mid = (l + r) >> 1;
  for (long long i = l; i <= r; i++)
    if (p[i].x != p[mid].x) ans.push_back(point(p[mid].x, p[i].y));
  get_ans(l, mid), get_ans(mid + 1, r);
}
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> p[i].x >> p[i].y;
  sort(p + 1, p + n + 1), get_ans();
  for (long long i = 1; i <= n; i++) ans.push_back(p[i]);
  sort(ans.begin(), ans.end());
  long long siz = unique(ans.begin(), ans.end()) - ans.begin();
  cout << siz << '\n';
  for (long long i = 0; i <= siz - 1; i++)
    cout << ans[i].x << ' ' << ans[i].y << '\n';
  return 0;
}
