#include <bits/stdc++.h>
using namespace std;
const int maxn = 200005;
const int maxm = maxn * 2;
const int inf = 0x3f3f3f3f;
int head[maxn], tol, cnt, sta[maxn], a[maxn];
long long dis[maxn], sum[maxn];
struct node {
  int to, next, w;
} g[maxm];
void add(int u, int v, int w) {
  g[tol].to = v;
  g[tol].w = w;
  g[tol].next = head[u];
  head[u] = tol++;
}
void dfs(int u, long long d, int cnt, int fa) {
  sta[cnt] = u;
  dis[cnt] = d;
  int l = lower_bound(dis + 1, dis + cnt + 1, d - a[u]) - dis;
  sum[sta[l - 1]]--;
  sum[u]++;
  for (int i = head[u]; i != -1; i = g[i].next) {
    int v = g[i].to;
    if (v == fa) continue;
    dfs(v, d + g[i].w, cnt + 1, u);
  }
}
void dfs1(int u, int fa) {
  for (int i = head[u]; i != -1; i = g[i].next) {
    int v = g[i].to;
    if (v == fa) continue;
    dfs1(v, u);
    sum[u] += sum[v];
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(head, -1, sizeof(head));
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    int x, y;
    cin >> x >> y;
    add(x, i, y);
    add(i, x, y);
  }
  dis[0] = -1e18;
  dfs(1, 0, 1, 0);
  dfs1(1, 0);
  for (int i = 1; i <= n; i++) cout << sum[i] - 1 << ' ';
  cout << '\n';
}
