#include <bits/stdc++.h>
using namespace std;
long long f[200005], dis[200005], mark[200005], sum[200005], len[200005];
int n, a[200005], head[200005], numedge;
struct Edge {
  long long v, l, next;
} edge[200005 * 2];
void init() {
  memset(dis, 0, sizeof(dis));
  memset(sum, 0, sizeof(sum));
  memset(len, 0, sizeof(len));
  memset(head, -1, sizeof(head));
  numedge = 0;
}
void dfs(int cur, int num) {
  dis[cur] += dis[f[cur]] + len[cur];
  mark[num] = cur;
  int l = 1, r = num - 1, x = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (dis[cur] - dis[mark[mid]] <= a[cur]) {
      x = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  if (x != -1) {
    sum[mark[x - 1]]--;
    sum[mark[num - 1]]++;
  }
  for (int i = head[cur]; i != -1; i = edge[i].next) {
    dfs(edge[i].v, num + 1);
  }
}
void add(int cur) {
  for (int i = head[cur]; i != -1; i = edge[i].next) {
    add(edge[i].v);
    sum[cur] += sum[edge[i].v];
  }
}
int main() {
  cin >> n;
  init();
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", a + i);
  for (i = 2; i <= n; i++) {
    scanf("%d%d", f + i, &j);
    edge[numedge].next = head[f[i]];
    edge[numedge].v = i;
    edge[numedge].l = j;
    len[i] = j;
    head[f[i]] = numedge++;
  }
  f[1] = 1;
  dfs(1, 1);
  add(1);
  for (i = 1; i <= n; i++) printf("%d ", sum[i]);
  return 0;
}
