#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5 + 10;
int n, numc;
set<pair<int, int> > SEG;
set<pair<int, int> >::iterator it;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int l, r, rp = 0;
    scanf("%d %d", &l, &r);
    numc++;
    while (SEG.lower_bound({l, -1}) != SEG.end() &&
           SEG.lower_bound({l, -1})->first <= r) {
      numc--;
      rp = SEG.lower_bound({l, -1})->second;
      SEG.erase(SEG.lower_bound({l, -1}));
    }
    r = max(r, rp);
    it = SEG.lower_bound({l, -1});
    if (it != SEG.begin()) {
      it--;
      if (l <= it->second) {
        numc--;
        l = it->first;
        r = max(r, it->second);
        SEG.erase(it);
      }
    }
    SEG.insert({l, r});
    printf("%d ", numc);
  }
}
