#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > Numbers(300005);
vector<int> Tree[810010];
map<pair<int, int>, int> answers;
void build(int pos, int l, int r) {
  if (l == r) {
    Tree[pos].push_back(Numbers[l].second);
    return;
  }
  int mid = (l + r) / 2;
  build(pos * 2, l, mid);
  build((pos * 2) + 1, mid + 1, r);
  int S1 = 0;
  int S2 = 0;
  while (1) {
    if (S1 >= Tree[pos * 2].size() && S2 >= Tree[(pos * 2) + 1].size()) break;
    int FirstNumber = Tree[pos * 2][S1];
    int SecondNumber = Tree[(pos * 2) + 1][S2];
    if (FirstNumber <= SecondNumber) {
      if (S1 < Tree[pos * 2].size()) {
        Tree[pos].push_back(FirstNumber);
        S1++;
      } else if (S1 >= Tree[pos * 2].size()) {
        if (S2 < Tree[(pos * 2) + 1].size()) {
          Tree[pos].push_back(SecondNumber);
          S2++;
        }
      }
    } else if (SecondNumber < FirstNumber) {
      if (S2 < Tree[(pos * 2) + 1].size()) {
        Tree[pos].push_back(SecondNumber);
        S2++;
      } else if (S2 >= Tree[(pos * 2) + 1].size()) {
        if (S1 < Tree[pos * 2].size()) {
          Tree[pos].push_back(FirstNumber);
          S1++;
        }
      }
    }
  }
  return;
}
long long findTree(int pos, int l, int r, int UL, int UR, int val) {
  if (l > UR || r < UL) return 0;
  if (l >= UL && r <= UR) {
    vector<int>::iterator it =
        lower_bound(Tree[pos].begin(), Tree[pos].end(), val);
    return Tree[pos].end() - it;
  }
  int mid = (l + r) / 2;
  long long x = findTree(pos * 2, l, mid, UL, UR, val);
  long long y = findTree((pos * 2) + 1, mid + 1, r, UL, UR, val);
  return x + y;
}
void PrintTree(int pos, int l, int r) {
  if (l == r) {
    cout << pos << endl;
    for (int j = 0; j < Tree[pos].size(); j++) cout << Tree[pos][j] << " ";
    cout << endl;
    return;
  }
  int mid = (l + r) / 2;
  PrintTree(pos * 2, l, mid);
  PrintTree((pos * 2) + 1, mid + 1, r);
  cout << pos << endl;
  for (int j = 0; j < Tree[pos].size(); j++) cout << Tree[pos][j] << " ";
  cout << endl;
  return;
}
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > sim(n + 1);
  for (int i = 1; i <= n; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    Numbers[i].first = r;
    Numbers[i].second = l;
    sim[i].first = r;
    sim[i].second = l;
  }
  sort(Numbers.begin() + 1, Numbers.begin() + n + 1);
  build(1, 1, n);
  for (int i = 1; i <= n; i++) {
    int ans = findTree(1, 1, n, 1, i - 1, Numbers[i].second);
    answers[{Numbers[i].second, Numbers[i].first}] = ans;
  }
  for (int i = 1; i < sim.size(); i++)
    printf("%d\n", answers[{sim[i].second, sim[i].first}]);
  return 0;
}
