#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, a[N], head[N], tot, fa[N][20];
long long dis[N], ans[N];
struct node {
  int nxt, to, l;
} e[N];
inline void add(int u, int v, int w) {
  e[++tot].nxt = head[u];
  e[tot].to = v;
  e[tot].l = w;
  head[u] = tot;
}
inline void dfs(int n) {
  for (int i = 1; i <= 19; i++) fa[n][i] = fa[fa[n][i - 1]][i - 1];
  int now = n;
  for (int i = 19; i >= 0; i--) {
    if (fa[now][i] && dis[n] - dis[fa[now][i]] <= a[n]) now = fa[now][i];
  }
  ans[fa[now][0]]--;
  ans[fa[n][0]]++;
  for (int i = head[n]; i; i = e[i].nxt) {
    dis[e[i].to] = dis[n] + e[i].l;
    dfs(e[i].to);
    ans[n] += ans[e[i].to];
  }
}
signed main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 2, x; i <= n; i++) {
    scanf("%lld%lld", &fa[i][0], &x);
    add(fa[i][0], i, x);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  return 0;
}
