#include <bits/stdc++.h>
using namespace std;
struct dor {
  int sg;
  bool sgl, sgr, fl;
  dor *l, *r;
  dor() {
    l = r = NULL;
    sg = fl = sgl = sgr = 0;
  }
  void pump() {
    sgl = l->sgl;
    sgr = r->sgr;
    sg = l->sg + r->sg;
    if (l->sgr && r->sgl) --sg;
  }
  void fll() {
    l = r = NULL;
    sg = fl = sgl = sgr = 1;
  }
};
const int m = 1e9;
int n, a, b;
dor *root;
void upd(int l, int r, int sl, int sr, dor *&t) {
  if (t == NULL) t = new dor();
  if (t->fl) return;
  if (l > sr || r < sl) return;
  if (l >= sl && r <= sr) {
    t->fll();
    return;
  }
  upd(l, (l + r) / 2, sl, sr, t->l);
  upd((l + r) / 2 + 1, r, sl, sr, t->r);
  t->pump();
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    upd(1, m, a, b - 1, root);
    cout << root->sg << " ";
  }
}
