#include <bits/stdc++.h>
using namespace std;
long long n, a[200005], ans[200005];
vector<long long> t[1000000];
void build(long long v, long long tl, long long tr) {
  if (tl == tr) {
    t[v].push_back(a[tl]);
    return;
  }
  long long tm = (tl + tr) / 2;
  build(2 * v, tl, tm);
  build(2 * v + 1, tm + 1, tr);
  auto v1 = t[2 * v], v2 = t[2 * v + 1];
  for (long long x : v1) t[v].push_back(x);
  for (long long x : v2) t[v].push_back(x);
  sort((t[v]).begin(), (t[v]).end());
}
long long query(long long v, long long l, long long r, long long tl,
                long long tr, long long x) {
  if (l > r) return 0;
  if (l == tl && r == tr) {
    auto it = upper_bound((t[v]).begin(), (t[v]).end(), x);
    long long z = it - t[v].begin();
    return z;
  }
  long long tm = (tl + tr) / 2;
  return query(2 * v, l, min(r, tm), tl, tm, x) +
         query(2 * v + 1, max(l, tm + 1), r, tm + 1, tr, x);
}
pair<pair<long long, long long>, long long> p[200005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> p[i].first.first >> p[i].first.second;
    p[i].second = i;
  }
  sort(p, p + n);
  for (long long i = 0; i < n; i++) a[i] = p[i].first.second;
  build(1, 0, n - 1);
  for (long long i = 0; i < n; i++) {
    long long z = query(1, i + 1, n - 1, 0, n - 1, a[i]);
    ans[p[i].second] = z;
  }
  for (long long i = 0; i < n; i++) cout << ans[i] << endl;
}
