#include <bits/stdc++.h>
using namespace std;
struct inff {
  long long s, e, ix;
} d[200020];
long long x[200020];
long long n;
long long bs(long long s, long long e, long long ff) {
  long long mid = (s + e) / 2;
  if (x[mid] == ff)
    return mid;
  else if (x[mid] > ff)
    return bs(s, mid - 1, ff);
  else
    return bs(mid + 1, e, ff);
}
bool com(inff a, inff b) { return a.e < b.e; }
long long tree[600060];
void ini(long long s, long long e, long long node) {
  tree[node] = 0;
  if (s == e) return;
  long long lft = node * 2, rht = node * 2 + 1, mid = (s + e) >> 1;
  ini(s, mid, lft);
  ini(mid + 1, e, rht);
  return;
}
long long S;
void update(long long s, long long e, long long node) {
  if (s == e) {
    tree[node]++;
    return;
  }
  long long lft = node * 2, rht = node * 2 + 1, mid = (s + e) >> 1;
  if (mid >= S)
    update(s, mid, lft);
  else
    update(mid + 1, e, rht);
  tree[node] = tree[lft] + tree[rht];
  return;
}
long long E;
long long qry(long long s, long long e, long long node) {
  if (S <= s && e <= E) return tree[node];
  if (s > E || e < S) return 0;
  long long lft = node * 2, rht = node * 2 + 1, mid = (s + e) >> 1;
  return qry(s, mid, lft) + qry(mid + 1, e, rht);
}
long long ans[200020];
int main() {
  scanf("%lld", &n);
  n--;
  for (long long i = 0; i <= n; i++) {
    scanf("%lld %lld", &d[i].s, &d[i].e);
    d[i].ix = i;
    x[i] = d[i].s;
  }
  sort(d, d + n + 1, com);
  sort(x, x + n + 1);
  ini(0, n, 1);
  E = n;
  for (long long i = 0; i <= n; i++) {
    S = bs(0, n, d[i].s);
    ans[d[i].ix] = qry(0, n, 1);
    update(0, n, 1);
  }
  for (long long i = 0; i <= n; i++) printf("%lld\n", ans[i]);
  return 0;
}
