#include <bits/stdc++.h>
using namespace std;
int n, k, l, r, R, f;
set<pair<int, int> > s, s1;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (k = 1; k <= n; k++) {
    cin >> l >> r;
    R = r;
    f = 0;
    while (s.size() && s.upper_bound({l, 0}) != s.end()) {
      pair<int, int> c = *s.upper_bound({l, 0});
      if ((c).first > r) break;
      R = max(R, c.second);
      s.erase(c);
      s1.erase({-c.first, c.second});
    }
    if (s1.size() && s1.upper_bound({-l, 0}) != s1.end()) {
      pair<int, int> rg = *s1.upper_bound({-l, 0});
      if (rg.second >= r)
        f = 1;
      else if (rg.second >= l) {
        l = -rg.first, s1.erase(rg), s.erase({-rg.first, rg.second});
      }
    }
    if (!f) {
      s.insert({l, R});
      s1.insert({-l, R});
    }
    cout << s.size() << " ";
  }
}
