#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<long long, int> > que;
vector<pair<long long, int> > G[200007];
vector<long long> val;
vector<int> ans;
vector<long long> dis;
void dfs(int now, int fa) {
  ans[now] = 1;
  int k =
      lower_bound(que.begin(), que.end(), make_pair(dis[now] - val[now], 0)) -
      que.begin();
  k--;
  if (k >= 0) ans[que[k].second]--;
  que.push_back(make_pair(dis[now], now));
  for (int i = 0; i < G[now].size(); i++) {
    int u = G[now][i].second;
    dis[u] = dis[now] + G[now][i].first;
    dfs(u, now);
    ans[now] += ans[u];
  }
  que.pop_back();
}
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i <= n; i++) {
      G[i].clear();
    }
    val.clear();
    que.clear();
    ans.clear();
    dis.clear();
    val.push_back(0);
    ans.push_back(0);
    dis.push_back(0);
    for (int i = 1; i <= n; i++) {
      long long a;
      scanf("%I64d", &a);
      val.push_back(a);
      ans.push_back(0);
      dis.push_back(0);
    }
    for (int i = 2; i <= n; i++) {
      int a;
      long long b;
      scanf("%d%I64d", &a, &b);
      G[a].push_back(make_pair(b, i));
    }
    dfs(1, -1);
    for (int i = 1; i <= n; i++) {
      if (i != 1) printf(" ");
      printf("%d", ans[i] - 1);
    }
    printf("\n");
  }
  return 0;
}
