#include <bits/stdc++.h>
const int C = 400001;
int a[C], b[C], vp[C], v[C], wynn = 0;
int pr[C], ran[C], low[C], sum[C];
void make_set(int x) { pr[x] = x, ran[x] = 0, sum[x] = 1, low[x] = x; }
int find_set(int x) {
  if (x != pr[x]) pr[x] = find_set(pr[x]);
  return pr[x];
}
void find_union(int a, int b) {
  int x = find_set(a), y = find_set(b);
  if (x == y) return;
  if (ran[x] > ran[y])
    pr[y] = x;
  else
    pr[x] = y;
  if (ran[x] == ran[y]) ran[y]++;
  if (low[x] < low[y])
    low[y] = low[x];
  else
    low[x] = low[y];
  if (sum[y] > 1) wynn--;
  sum[x] = sum[y] = sum[x] + sum[y];
}
int pom[C];
void Sebasort(int tab[], int l, int r) {
  int lim = 2, limi = l + 1, limj = l + 2, j = limi, i = l, k = l;
  while (lim / 2 <= r - l + 1) {
    while (i <= r) {
      if (limj > r) limj = r + 1;
      if ((tab[j] < tab[i] && j < limj) || i >= limi)
        pom[k] = tab[j], j++;
      else
        pom[k] = tab[i], i++;
      k++;
      if (i == limi && j == limj) limi += lim, limj += lim, i = j, j = limi;
    }
    for (i = l; i <= r; i++) tab[i] = pom[i];
    lim *= 2, limi = l + lim / 2, limj = l + lim, j = limi, i = k = l;
  }
}
inline int bin(int tab[], int v, int l, int r) {
  int m;
  while (l <= r) {
    m = (l + r) / 2;
    if (tab[m] == v) return m;
    if (tab[m] > v)
      r = m - 1;
    else
      l = m + 1;
  }
  return -1;
}
int main() {
  int i, n, dd, j = 1, m, s, ss, f;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &a[i], &b[i]);
    vp[i * 2] = a[i], vp[i * 2 + 1] = b[i];
  }
  dd = 2 * n;
  Sebasort(vp, 0, dd - 1);
  v[0] = vp[0];
  for (i = 1; i < dd; i++) {
    if (vp[i] != vp[i - 1]) v[j] = vp[i], j++;
  }
  m = j - 1;
  for (i = 0; i <= m; i++) make_set(i);
  for (i = 0; i < n; i++) {
    s = bin(v, b[i], 0, m);
    ss = bin(v, a[i], 0, m);
    f = find_set(s);
    if (sum[f] > 1) wynn--;
    while (s > ss) {
      find_union(s, s - 1);
      s = low[find_set(s - 1)];
    }
    wynn++;
    printf("%d ", wynn);
  }
  return 0;
}
