#include <bits/stdc++.h>
using namespace std;
int n;
int a[200007];
int anc[200007][20];
int dep[200007];
bool vis[200007];
long long d[200007];
int ans[200007];
int temp[200007];
struct Edge {
  int v, w;
  Edge(int v = 0, int w = 0) : v(v), w(w) {}
};
vector<Edge> Adj[200007];
void dfs(int u) {
  vis[u] = 1;
  for (int i = 1; i < 20; i++) {
    anc[u][i] = anc[anc[u][i - 1]][i - 1];
  }
  for (int i = 0; i < Adj[u].size(); i++) {
    int v = Adj[u][i].v;
    int w = Adj[u][i].w;
    if (vis[v] == 0) {
      dep[v] = dep[u] + 1;
      anc[v][0] = u;
      d[v] = d[u] + w;
      dfs(v);
    }
  }
}
void dfs1(int u) {
  vis[u] = 1;
  for (int i = 0; i < Adj[u].size(); i++) {
    int v = Adj[u][i].v;
    if (vis[v]) continue;
    dfs1(v);
    temp[u] += temp[v];
  }
  ans[u] = temp[u];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    int u, v, w;
    scanf("%d%d", &u, &w);
    v = i + 1;
    Adj[u].push_back(Edge(v, w));
    Adj[v].push_back(Edge(u, w));
  }
  dep[1] = 1;
  anc[1][0] = 1;
  dfs(1);
  for (int i = 2; i <= n; i++) {
    int p = i;
    int t = 0;
    for (int j = 19; j >= 0; j--) {
      if (dep[p] <= (1 << j) || t + d[p] - d[anc[p][j]] > a[i]) continue;
      t += d[p] - d[anc[p][j]];
      p = anc[p][j];
    }
    temp[anc[i][0]]++;
    if (p != 1) temp[anc[p][0]]--;
  }
  memset(vis, 0, sizeof(vis));
  dfs1(1);
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  return 0;
}
