#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a, b;
  vector<int> c(1e6 + 2, 0);
  for (int i = 0; i < N; i++) {
    cin >> a >> b;
    c[a]++;
    c[b]--;
  }
  for (int i = 0; i < c.size(); i++) {
    c[i + 1] += c[i];
  }
  for (int i = 0; i < 10; i++) {
    cout << c[i] << endl;
  }
  int maxnum = 0;
  for (int i = 1; i < c.size(); i++) {
    if (i == c[i] + 1) maxnum = i;
  }
  cout << maxnum - 1 << endl;
  return 0;
}
