#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
struct aa {
  int l, r;
  int v;
};
bool operator<(aa a, aa b) { return a.r < b.r; }
inline aa qwq(int l, int r, int v) {
  aa a;
  a.l = l;
  a.r = r;
  a.v = v;
  return a;
}
set<aa> s;
int read() {
  register int x = 0, ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x;
}
void wt() {
  for (set<aa>::iterator i = s.begin(); i != s.end(); i++) {
    cout << i->l << " " << i->r << " " << i->v << "\n";
  }
  cout << "------\n";
}
void spliT(set<aa>::iterator i, int x) {
  int l = i->l;
  int r = i->r;
  int v = i->v;
  if (x >= r) return;
  if (x < l) return;
  s.erase(i);
  s.insert(qwq(l, x, v));
  s.insert(qwq(x + 1, r, v));
  if (v == 1) ans++;
}
void mergE(set<aa>::iterator i) {
  int l = i->l, r = i->r, v = i->v;
  set<aa>::iterator j = i, k = i;
  if (l != 1) {
    j--;
    if (j->v == v) {
      l = j->l;
      s.erase(j);
      if (v == 1) ans--;
    }
  }
  if (r != n) {
    k++;
    if (k->v == v) {
      r = k->r;
      s.erase(k);
      if (v == 1) ans--;
    }
  }
  s.erase(i);
  s.insert(qwq(l, r, v));
}
void Ass(int l, int r) {
  set<aa>::iterator x = s.lower_bound((aa){0, l - 1, 0});
  if (l != 1) spliT(x, l - 1);
  set<aa>::iterator y = s.lower_bound((aa){0, r, 0});
  spliT(y, r);
  x = s.lower_bound((aa){0, l, 0});
  y = s.lower_bound((aa){0, r + 1, 0});
  for (set<aa>::iterator i = x; i != y; i++) {
    if (i->v == 1) ans--;
  }
  s.erase(x, y);
  s.insert(qwq(l, r, 1));
  ans++;
  x = s.lower_bound((aa){0, l, 0});
  mergE(x);
}
signed main() {
  n = 1000000005;
  cin >> m;
  s.insert(qwq(1, n, 0));
  for (int i = 1; i <= m; i++) {
    int l, r;
    l = read();
    r = read();
    r--;
    Ass(l, r);
    printf("%d\n", ans);
  }
  return 0;
}
