#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n;
struct point {
  int x;
  bool beg;
  int ind;
  bool operator<(point other) const { return x < other.x; }
  point() {}
  point(int _x, bool _beg, int _ind) {
    x = _x;
    beg = _beg;
    ind = _ind;
  }
} a[2 * N];
struct seg_tree {
  int val[4 * N], lazy[4 * N];
  void refresh(int pos, int low, int high) {
    if (lazy[pos] == 0) return;
    val[pos] += lazy[pos] * (high - low + 1);
    if (low != high) {
      lazy[pos * 2] += lazy[pos];
      lazy[pos * 2 + 1] += lazy[pos];
    }
    lazy[pos] = 0;
  }
  int query(int pos, int low, int high, int l, int r) {
    refresh(pos, low, high);
    if (l > high || r < low) return 0;
    if (l <= low && r >= high) return val[pos];
    int mid = (low + high) / 2;
    return query(pos * 2, low, mid, l, r) +
           query(pos * 2 + 1, mid + 1, high, l, r);
  }
  void update(int pos, int low, int high, int l, int r, int d) {
    refresh(pos, low, high);
    if (l > high || r < low) return;
    if (l <= low && r >= high) {
      lazy[pos] += d;
      refresh(pos, low, high);
      return;
    }
    int mid = (low + high) / 2;
    update(pos * 2, low, mid, l, r, d);
    update(pos * 2 + 1, mid + 1, high, l, r, d);
    val[pos] = val[pos * 2] + val[pos * 2 + 1];
  }
  void build(int pos, int low, int high, int arr[]) {
    if (low == high) {
      val[pos] = arr[low];
      return;
    }
    int mid = (low + high) / 2;
    build(pos * 2, low, mid, arr);
    build(pos * 2 + 1, mid + 1, high, arr);
    val[pos] = val[pos * 2] + val[pos * 2 + 1];
  }
} seg;
int rem[N];
long long ans[N];
int main() {
  int i, a_ind = 0;
  int l, r;
  cin >> n;
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &l, &r);
    a_ind++;
    a[a_ind] = point(l, true, i);
    a_ind++;
    a[a_ind] = point(r, false, i);
  }
  sort(a + 1, a + 2 * n + 1);
  int cur = 0;
  for (i = 1; i <= 2 * n; i++) {
    if (a[i].beg) {
      cur++;
      rem[a[i].ind] = cur;
    } else {
      ans[a[i].ind] = seg.query(1, 1, n, rem[a[i].ind], rem[a[i].ind]);
      if (1 <= rem[a[i].ind] - 1) seg.update(1, 1, n, 1, rem[a[i].ind] - 1, 1);
    }
  }
  for (i = 1; i <= n; i++) {
    printf("%I64d\n", ans[i]);
  }
  return 0;
}
