#include <bits/stdc++.h>
using namespace std;
long long spf[20];
long long fac[20];
void sieve() {
  spf[1] = 1;
  for (long long i = 2; i < 20; i++) spf[i] = i;
  for (long long i = 4; i < 20; i += 2) spf[i] = 2;
  for (long long i = 3; i * i < 20; i++) {
    if (spf[i] == i) {
      for (long long j = i * i; j < 20; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
map<long long, long long> getfactor(long long a) {
  map<long long, long long> m;
  while (a > 1) {
    m[spf[a]]++;
    a /= spf[a];
  }
  return m;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long inverse(long long a, long long p) { return power(a, p - 2, p); }
long long ncr(long long n, long long r, long long p) {
  if (r == 0) return 1;
  return (fac[n] * inverse(fac[r], p) % p * inverse(fac[n - r], p) % p) % p;
}
void solve() {
  set<pair<long long, long long> > s;
  long long n;
  cin >> n;
  long long ans[n];
  ans[0] = 1;
  for (long long i = 0; i < n; i++) {
    long long l, r;
    cin >> l >> r;
    long long maxl = l;
    long long maxr = r;
    auto it = s.lower_bound(make_pair(l + 1, -10000));
    auto it2 = s.lower_bound(make_pair(r + 1, -100000));
    if (it2 != s.begin()) {
      auto it3 = it2;
      it3--;
      if (it3->second >= maxr) maxr = it3->second;
    }
    if (it != s.begin()) {
      auto it3 = it;
      it3--;
      if (it3->second >= maxl) maxl = it3->first;
    }
    vector<pair<long long, long long> > v;
    it = s.lower_bound(make_pair(maxl, -10000));
    for (; it != s.end(); it++) {
      if (it->second <= maxr)
        v.push_back(make_pair(it->first, it->second));
      else
        break;
    }
    for (auto it4 : v) {
      if (s.find(it4) != s.end()) s.erase(it4);
    }
    s.insert(make_pair(maxl, maxr));
    ans[i] = s.size();
  }
  for (long long i = 0; i < n; i++) {
    cout << ans[i] << " ";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
}
