#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200100;
const long long INF = 1e15;
vector<pair<long long, long long> > V;
set<pair<long long, long long> > S;
int N, a, b;
vector<long long> decom[MAXN];
void dnc(int second, int e) {
  if (second >= e) return;
  int m = (second + e) / 2;
  int xc = V[m].first;
  for (int k = second; k <= e; ++k) {
    S.insert(make_pair(xc, V[k].second));
  }
  dnc(second, m - 1);
  dnc(m + 1, e);
}
int main() {
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a >> b;
    V.emplace_back(a, b);
    S.insert(make_pair(a, b));
  }
  sort(V.begin(), V.end());
  dnc(0, N - 1);
  cout << (long long)S.size() << '\n';
  for (auto i : S) cout << i.first << ' ' << i.second << '\n';
}
