#include <bits/stdc++.h>
using namespace std;
int n;
struct Edge {
  int v, w;
  Edge(int v = 0, int w = 0) : v(v), w(w) {}
};
vector<Edge> adj[200005];
bool vis[200005];
long long d[200005];
int a[200005];
int tag[200005], dep[200005];
int anc[200005][20];
void dfs0(int u) {
  vis[u] = 1;
  for (int j = 1; j < 20; j++) {
    if (dep[u] <= (1 << j)) break;
    anc[u][j] = anc[anc[u][j - 1]][j - 1];
  }
  int v, w;
  for (int k = 0; k < adj[u].size(); k++) {
    v = adj[u][k].v;
    w = adj[u][k].w;
    if (vis[v]) continue;
    anc[v][0] = u;
    d[v] = d[u] + w;
    dep[v] = dep[u] + 1;
    dfs0(v);
  }
}
int ans[200005];
void dfs1(int u) {
  vis[u] = 1;
  int v;
  for (int k = 0; k < adj[u].size(); k++) {
    v = adj[u][k].v;
    if (vis[v]) continue;
    dfs1(v);
    tag[u] += tag[v];
  }
  ans[u] = tag[u];
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int u, w;
  for (int i = 1; i < n; i++) {
    cin >> u >> w;
    adj[u].push_back(Edge(i + 1, w));
    adj[i + 1].push_back(Edge(u, w));
  }
  dep[1] = 1;
  anc[1][0] = 1;
  dfs0(1);
  memset(vis, 0, sizeof(vis));
  int p = 0, pre = 0;
  for (int i = 2; i <= n; i++) {
    p = i;
    pre = 0;
    for (int j = 20; j >= 0; j--) {
      if (dep[p] <= (1 << j) || pre + (d[p] - d[anc[p][j]]) > a[i]) continue;
      pre += d[p] - d[anc[p][j]];
      p = anc[p][j];
    }
    tag[anc[i][0]]++;
    if (p != 1) tag[anc[p][0]]--;
  }
  dfs1(1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
