#include <bits/stdc++.h>
using namespace std;
string its(int x) {
  char aa = x / 10 + '0';
  char cc = x % 10 + '0';
  string s = "  ";
  s[0] = aa;
  s[1] = cc;
  return s;
}
int n, a, b;
set<pair<int, int> > s;
set<pair<int, int> >::iterator it, it1;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    it = s.lower_bound(make_pair(a, -1));
    int st = a, en = b;
    if (it != s.begin()) {
      it1 = it;
      it1--;
      if ((*it1).second >= a) {
        st = (*it1).first;
        en = max(en, (*it1).second);
        s.erase(it1);
      }
    }
    while (it != s.end() && (*it).first <= b) {
      en = max(en, (*it).second);
      it1 = it;
      it++;
      s.erase(it1);
    }
    s.insert(make_pair(st, en));
    cout << s.size() << "\n";
  }
}
