#include <bits/stdc++.h>
using namespace std;
char buf[25];
map<int, int> h;
const int maxn = 2000010;
struct t {
  int lc, rc, l, r, v;
  bool tl, tr, tag;
} t[maxn];
int a[maxn], b[maxn], c[maxn];
int n, m, num, rt;
int read() {
  int x = 0, f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return f ? -x : x;
}
void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (!x) {
    putchar('0');
    return;
  }
  int cnt = 0;
  while (x) {
    buf[++cnt] = '0' + x % 10;
    x /= 10;
  }
  for (int i = cnt; i >= 1; --i) putchar(buf[i]);
}
void pushup(int x) {
  int lc = t[x].lc, rc = t[x].rc;
  t[x].v = t[lc].v + t[rc].v - (t[lc].tr && t[rc].tl);
  t[x].tl = t[lc].tl;
  t[x].tr = t[rc].tr;
}
void pushdown(int x) {
  if (t[x].tag) {
    int lc = t[x].lc, rc = t[x].rc;
    t[lc].tag = t[rc].tag = true;
    t[lc].tl = t[lc].tr = t[rc].tl = t[rc].tr = true;
    t[lc].v = t[rc].v = 1;
    t[x].tag = false;
  }
}
void change(int x, int l, int r) {
  if (l <= t[x].l && t[x].r <= r) {
    t[x].tag = true;
    t[x].v = 1;
    t[x].tl = t[x].tr = true;
    return;
  }
  pushdown(x);
  if (t[t[x].lc].r >= l) change(t[x].lc, l, r);
  if (t[t[x].rc].l <= r) change(t[x].rc, l, r);
  pushup(x);
}
int build(int l, int r) {
  int x = ++num;
  t[x].l = l;
  t[x].r = r;
  if (l == r) {
    t[x].tl = t[x].tr = t[x].tag = false;
    t[x].v = 0;
  } else {
    int mid = (l + r) >> 1;
    t[x].lc = build(l, mid);
    t[x].rc = build(mid + 1, r);
    pushup(x);
  }
  return x;
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) {
    a[i] = read();
    b[i] = read();
    --b[i];
    c[++m] = a[i];
    c[++m] = b[i];
  }
  sort(c + 1, c + 1 + m);
  int sum = 0;
  for (int i = 1; i <= m; ++i)
    if (i == 1 || c[i] != c[i - 1]) {
      ++sum;
      if (i != 1 && c[i] != c[i - 1] + 1) ++sum;
      h[c[i]] = sum;
    }
  for (int i = 1; i <= n; ++i) {
    a[i] = h[a[i]];
    b[i] = h[b[i]];
  }
  int L = 1, R = sum;
  rt = build(L, R);
  for (int i = 1; i <= n; ++i) {
    change(rt, a[i], b[i]);
    write(t[rt].v);
    putchar(' ');
  }
  putchar('\n');
  return 0;
}
