#include <bits/stdc++.h>
using namespace std;
long double eps = 0.000001;
long double pi = 3.141592;
struct point {
  int x, y;
  point() { x = y = 0; }
  point(int a, int b) {
    x = a;
    y = b;
  }
  void read() { cin >> x >> y; }
  void write() { cout << x << " " << y << " "; }
};
bool cmp_x(point a, point b) { return a.x < b.x || (a.x == b.x && a.y < b.y); }
int med(vector<point> &a) {
  sort(a.begin(), a.end(), cmp_x);
  int n = a.size();
  return a[n / 2].x;
}
vector<point> run(vector<point> a) {
  if (a.size() == 0) {
    return a;
  }
  int m = med(a);
  if (a[0].x == a[a.size() - 1].x) {
    return a;
  }
  vector<point> x, y;
  set<int> s;
  for (int i = 0; i < a.size(); i++) {
    s.insert(a[i].y);
    if (a[i].x < m) {
      x.push_back(a[i]);
    }
    if (a[i].x > m) {
      y.push_back(a[i]);
    }
  }
  vector<point> kek = run(x);
  vector<point> lol = run(y);
  for (int i = 0; i < kek.size(); i++) {
    s.insert(kek[i].y);
  }
  for (int i = 0; i < lol.size(); i++) {
    s.insert(lol[i].y);
  }
  vector<point> ans;
  for (int i = 0; i < kek.size(); i++) {
    ans.push_back(kek[i]);
  }
  for (int i = 0; i < lol.size(); i++) {
    ans.push_back(lol[i]);
  }
  for (auto puk : s) {
    ans.push_back(point(m, puk));
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<point> a(n);
  for (int i = 0; i < n; i++) {
    a[i].read();
  }
  vector<point> gego = run(a);
  vector<point> ans;
  int k = med(gego);
  for (int i = 0; i < gego.size(); i++) {
    if (i == 0 || gego[i].x != gego[i - 1].x || gego[i].y != gego[i - 1].y) {
      ans.push_back(gego[i]);
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].x << ' ' << ans[i].y;
    if (i != ans.size() - 1) {
      cout << endl;
    }
  }
  return 0;
}
