#include <bits/stdc++.h>
using namespace std;
int N = 1000000;
long long a[2000005];
vector<pair<int, long long>> way[2000005];
long long dist[2000005];
long long key[2000005];
pair<long long, int> p[2000005];
map<long long, int> m;
int t[3000005];
int res[2000005];
int qr(int p) {
  int res = 0;
  for (p += N; p > 0; p >>= 1) res += t[p];
  return res;
}
void add(int l, int r, int val) {
  for (l += N, r += N; l < r; l >>= 1, r >>= 1) {
    if (l & 1) t[l++] += val;
    if (r & 1) t[--r] += val;
  }
  return;
}
void dfs(int pos, int from, long long sum) {
  dist[pos] = sum;
  for (int i = 0; i < way[pos].size(); i++)
    if (way[pos][i].first != from)
      dfs(way[pos][i].first, pos, sum + way[pos][i].second);
  return;
}
void findres(int pos, int from) {
  add(m[key[pos]], 999999, 1);
  res[pos] = qr(m[dist[pos]]);
  for (int i = 0; i < way[pos].size(); i++)
    if (way[pos][i].first != from) findres(way[pos][i].first, pos);
  res[pos] = qr(m[dist[pos]]) - res[pos];
  return;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 0; i < n - 1; i++) {
    int p;
    long long w;
    scanf("%d%lld", &p, &w);
    way[p].push_back({i + 2, w});
    way[i + 2].push_back({p, w});
  }
  dfs(1, 0, 0);
  for (int i = 1; i <= n; i++) key[i] = dist[i] - a[i], p[i] = {key[i], i};
  for (int i = 1; i <= n; i++) p[n + i] = {dist[i], n + i};
  sort(p + 1, p + 2 * n + 1);
  for (int i = 1; i <= 2 * n; i++) m[p[i].first] = i;
  findres(1, 0);
  for (int i = 1; i <= n; i++) printf("%d ", res[i]);
  return 0;
}
