#include <bits/stdc++.h>
const int N = 2e5;
int n;
int a[N + 5];
int fa[N + 5][30], ans[N + 5];
long long sum[N + 5];
struct Edge {
  int to, dis, next;
} edge[N + 5];
int num_edge, head[N + 5];
void add(int from, int to, int dis) {
  edge[++num_edge] = (Edge){to, dis, head[from]};
  head[from] = num_edge;
}
int read() {
  register int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * f;
}
void search(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 p = head[u]; p; p = edge[p].next) {
    int v = edge[p].to, d = edge[p].dis;
    fa[v][0] = u;
    sum[v] = sum[u] + d;
    search(v);
    ans[u] += ans[v];
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  int u, v, d;
  for (int i = 2; i <= n; i++) {
    u = read(), d = read();
    add(u, i, d);
  }
  search(1);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
