#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n;
set<pair<int, int> > S;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    set<pair<int, int> >::iterator it;
    it = S.lower_bound(make_pair(a, 0));
    int l = a, r = b;
    for (; it != S.end() && (*it).second <= b;) {
      l = min(l, (*it).second);
      r = max(r, (*it).first);
      set<pair<int, int> >::iterator lst = it;
      ++it;
      S.erase(lst);
    }
    S.insert(make_pair(r, l));
    printf("%d\n", S.size());
  }
  return 0;
}
