#include <bits/stdc++.h>
using namespace std;
const unsigned long long BIGEST = 1000000000000000000 + 1000000000000000000;
const long long BIGER = 1000000000000000000;
const int BIG = 1000000000;
const long long MOD = 1004535809;
const long long LMOD = 154590409516822759;
int n;
int x, y;
int mx;
struct seg {
  int dat[2000005];
  int ch(int a, int b, int v, int l = 1, int r = mx, int k = 1) {
    if (r < a || b < l) return 0;
    if (a <= l && r <= b) {
      dat[k] += v;
      return 0;
    }
    ch(a, b, v, l, (l + r) / 2, k * 2);
    ch(a, b, v, (l + r) / 2 + 1, r, k * 2 + 1);
    return 0;
  }
  int q(int a, int b, int l = 1, int r = mx, int k = 1) {
    if (r < a || b < l) return 0;
    if (a <= l && r <= b) {
      return dat[k];
    }
    return dat[k] + q(a, b, l, (l + r) / 2, k * 2) +
           q(a, b, (l + r) / 2 + 1, r, k * 2 + 1);
  }
} T;
pair<pair<int, int>, int> v[200005];
map<int, int> mp;
vector<int> vt;
int a[200005];
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x, &y);
    v[i] = make_pair(make_pair(x, y), i);
    vt.push_back(x);
    vt.push_back(y);
  }
  sort(vt.begin(), vt.end());
  for (int i = 0; i < vt.size(); i++) {
    mp[vt[i]] = i + 1;
  }
  mx = vt.size();
  for (int i = 1; i <= n; i++) {
    v[i].first.first = mp[v[i].first.first];
    v[i].first.second = mp[v[i].first.second];
    T.ch(v[i].first.second + 1, mx, 1);
  }
  sort(v + 1, v + 1 + n);
  for (int i = 1; i <= n; i++) {
    a[v[i].second] = T.q(v[i].first.second, v[i].first.second);
    T.ch(v[i].first.second + 1, mx, -1);
  }
  for (int i = 1; i <= n; i++) {
    cout << a[i] << " ";
  }
  return 0;
}
