#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int n, a[200010], head[200010], fa[200010][25], ans[200010];
long long dis[200010], sum[200010];
struct edge {
  int to, next, val;
} e[200010];
int len;
void addedge(int u, int v, int w) {
  e[++len].to = v;
  e[len].val = w;
  e[len].next = head[u];
  head[u] = len;
}
void dfs(int u) {
  for (int i = 1; i <= 20; i++) fa[u][i] = fa[fa[u][i - 1]][i - 1];
  int now = u;
  for (int i = 20; i >= 0; i--)
    if (fa[now][i] && sum[u] - sum[fa[now][i]] <= a[u]) now = fa[now][i];
  ans[fa[now][0]]--;
  ans[fa[u][0]]++;
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to, d = e[i].val;
    fa[v][0] = u;
    sum[v] = sum[u] + d;
    dfs(v);
    ans[u] += ans[v];
  }
}
int main() {
  n = read();
  for (register int i = 1; i <= n; i++) a[i] = read();
  for (register int i = 2; i <= n; i++) {
    int p = read(), x = read();
    addedge(p, i, x);
  }
  dfs(1);
  for (register int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
