#include <bits/stdc++.h>
using namespace std;
int N;
int C[300000];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 0; i < (N); i++) {
    int a, b;
    cin >> a >> b;
    C[a + b]++;
  }
  vector<int> ans;
  for (int i = 0; i < (300000 - 1); i++) {
    C[i + 1] += C[i] / 2;
    if (C[i] % 2) ans.push_back(i);
  }
  cout << ans.size() << "\n";
  for (int x : ans) cout << x << " " << 0 << "\n";
  return 0;
}
