#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int t, n, m, x, y, itr, a[N], head[N], fa[N][21], b[N], ans[N];
long long dis[N];
bool vis[N];
struct Node {
  int v, w, next;
} edge[N * 2];
inline void addedge(int u, int v, int w) {
  edge[itr].v = v;
  edge[itr].w = w;
  edge[itr].next = head[u];
  head[u] = itr++;
}
void dfs(int x) {
  for (int i = 1; i <= 20; ++i) fa[x][i] = fa[fa[x][i - 1]][i - 1];
  for (int i = head[x]; ~i; i = edge[i].next) {
    int v = edge[i].v;
    if (fa[v][0]) continue;
    fa[v][0] = x;
    dis[v] = dis[x] + edge[i].w;
    dfs(v);
  }
}
inline void work(int x) {
  int now = x;
  for (int i = 20; i >= 0; --i) {
    if (dis[x] - dis[fa[now][i]] <= a[x]) now = fa[now][i];
  }
  b[x]++;
  if (now != 1) b[fa[now][0]]--;
}
int dfs2(int x) {
  int tmp = b[x];
  vis[x] = true;
  for (int i = head[x]; ~i; i = edge[i].next)
    if (!vis[edge[i].v]) {
      int v = edge[i].v;
      tmp += dfs2(v);
    }
  ans[x] = tmp;
  return tmp;
}
int main() {
  while (scanf("%d", &n) != EOF) {
    itr = 0;
    for (int i = 1; i <= n; ++i) head[i] = -1, b[i] = 0, vis[i] = false;
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    for (int i = 1; i <= n - 1; ++i) {
      scanf("%d%d", &x, &y);
      addedge(i + 1, x, y);
      addedge(x, i + 1, y);
    }
    fa[1][0] = 1;
    dis[1] = 0;
    dfs(1);
    for (int i = 1; i <= n; ++i) {
      work(i);
    }
    dfs2(1);
    for (int i = 1; i <= n; ++i) {
      if (i != 1) printf(" ");
      printf("%d", ans[i] - 1);
    }
    printf("\n");
  }
  return 0;
}
