#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const int N = 2e5 + 100;
int n;
vector<pair<long long, long long> > point;
void solve(int b, int e) {
  if (e - b == 1) return;
  int mid = (b + e) / 2;
  solve(b, mid);
  solve(mid, e);
  for (int i = b; i < e; i++)
    point.push_back(make_pair(point[mid].first, point[i].second));
  return;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    x += INF;
    y += INF;
    point.push_back(make_pair(x, y));
  }
  sort(point.begin(), point.end());
  solve(0, n);
  sort(point.begin(), point.end());
  point.resize(unique(point.begin(), point.end()) - point.begin());
  cout << point.size() << endl;
  for (int i = 0; i < point.size(); i++)
    cout << point[i].first - INF << " " << point[i].second - INF << endl;
}
