#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
struct Graph {
  int head[N], v[N << 1], w[N << 1], next[N << 1], e;
  void clear() {
    e = 0;
    memset(head, -1, sizeof(head));
  }
  void add(int u, int v, int w) {
    this->v[e] = v;
    this->w[e] = w;
    next[e] = head[u];
    head[u] = e++;
  }
} G;
int n, a[N], ans[N], id[N];
long long pre[N];
void dfs(int u, int d, long long sum) {
  id[d] = u;
  pre[d] = sum;
  int p = lower_bound(pre + 1, pre + 1 + d, sum - a[u]) - pre;
  ans[id[d - 1]]++;
  ans[id[p - 1]]--;
  for (int e = G.head[u]; ~e; e = G.next[e]) {
    int v = G.v[e], w = G.w[e];
    dfs(v, d + 1, sum + w);
    ans[u] += ans[v];
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  G.clear();
  for (int i = 2; i <= n; i++) {
    int p, w;
    scanf("%d%d", &p, &w);
    G.add(p, i, w);
  }
  dfs(1, 1, 0);
  for (int i = 1; i <= n; i++) {
    printf("%d%c", ans[i], " \n"[i == n]);
  }
  return 0;
}
