#include <bits/stdc++.h>
using namespace std;
long long par[200005][20];
long long a[200005], n, dist[200005];
vector<pair<long long, long long> > gr[200005];
long long sum[200005], st[200005], en[200005];
long long ans[200005];
void dfs(long long now, long long p, long long val) {
  par[now][0] = p;
  dist[now] = val;
  long long i, j;
  for (i = 1; i < 20; i++) {
    if (par[now][i - 1] + 1) {
      par[now][i] = par[par[now][i - 1]][i - 1];
    }
  }
  long long v = now;
  while (1) {
    for (i = 0; i < 20; i++) {
      if (par[v][i] == -1) break;
      if (dist[par[v][i]] < dist[now] - a[now]) break;
    }
    if (i == 0) break;
    v = par[v][i - 1];
  }
  if (v != now) {
    if (v == par[now][0])
      ans[par[now][0]] += 1;
    else {
      st[par[now][0]] += 1;
      if (par[v][0] + 1) st[par[v][0]] -= 1;
    }
  }
  for (auto a : gr[now]) {
    if (a.first == p) continue;
    dfs(a.first, now, val + a.second);
  }
}
long long go(long long now, long long p) {
  long long val = st[now];
  for (auto a : gr[now]) {
    if (a.first == p) continue;
    val += go(a.first, now);
  }
  ans[now] += val;
  return val;
}
int main() {
  long long i, j;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (i = 2; i <= n; i++) {
    long long p, w;
    scanf("%lld", &p);
    scanf("%lld", &w);
    gr[p].push_back({i, w});
    gr[i].push_back({p, w});
  }
  memset(par, -1, sizeof(par));
  dfs(1, -1, 0);
  go(1, -1);
  for (i = 1; i <= n; i++) printf("%lld ", ans[i]);
  return 0;
}
