#include <bits/stdc++.h>
using namespace std;
const int maxx = 300010;
vector<pair<int, long long> > g[maxx];
int n, m, u;
int ans = 0, total = 0, sum = 0, cnt = 0;
long long w;
long long a[maxx], dep[maxx], fa[maxx], dis[maxx], tree[maxx];
long long f[maxx][41];
void dfs(int x, int father) {
  fa[x] = father;
  dep[x] = dep[father] + 1;
  for (register int i = 1; (1 << i) <= dep[x]; i++)
    f[x][i] = f[f[x][i - 1]][i - 1];
  for (register int i = 0; i < g[x].size(); i++) {
    int to = g[x][i].first;
    long long val = g[x][i].second;
    if (to == father) continue;
    f[to][0] = x;
    dis[to] = val + dis[x];
    dfs(to, x);
  }
  int to = x;
  while (dis[x] - dis[f[to][0]] <= a[x] && f[to][0] != 0) {
    for (register int i = 20; i >= 0; i--) {
      if (dis[x] - dis[f[to][i]] <= a[x] && to != 0) to = f[to][i];
    }
  }
  tree[fa[to]]--;
  tree[fa[x]]++;
}
void dfs1(int x, int father) {
  for (register int i = 0; i < g[x].size(); i++) {
    int to = g[x][i].first;
    if (to == father) continue;
    dfs1(to, x);
    tree[x] += tree[to];
  }
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (register int i = 2; i <= n; i++) {
    scanf("%d%lld", &u, &w);
    fa[i] = u;
    g[u].push_back(make_pair(i, w));
  }
  dfs(1, 0);
  dfs1(1, 0);
  for (register int i = 1; i <= n; i++) printf("%d ", tree[i]);
  return 0;
}
