#include <bits/stdc++.h>
using namespace std;
bool inter(const pair<int, int> &a, const pair<int, int> &b) {
  int lb = max(a.first, b.first);
  int rb = min(a.second, b.second);
  return (lb <= rb);
}
int main() {
  srand(1373737);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, l, r;
  cin >> n;
  set<pair<int, int> > have;
  stack<pair<int, int> > del;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    auto it = have.upper_bound(make_pair(r + 1, -1));
    if (it == have.begin())
      have.insert(make_pair(l, r));
    else {
      it--;
      while (inter(*it, make_pair(l, r))) {
        del.push(*it);
        r = max(r, it->second);
        l = min(l, it->first);
        if (it == have.begin()) break;
        it--;
      }
      while (!del.empty()) {
        have.erase(del.top());
        del.pop();
      }
      have.insert(make_pair(l, r));
    }
    cout << (int)have.size() << " ";
  }
  return 0;
}
