#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 3;
long long a[mxn], ans[mxn], dep[mxn], n;
vector<pair<int, long long> > g[mxn];
vector<pair<long long, int> > pat;
void dfs(int u, int p) {
  int id =
      lower_bound((pat).begin(), (pat).end(), make_pair(dep[u] - a[u], 0)) -
      pat.begin() - 1;
  if (id >= 0) --ans[pat[id].second];
  ++ans[p];
  pat.push_back(make_pair(dep[u], u));
  for (int(i) = (int)(0); (i) < (int)(g[u].size()); ++(i)) {
    int v = g[u][i].first;
    dep[v] = dep[u] + g[u][i].second;
    dfs(v, u);
    ans[u] += ans[v];
  }
  pat.pop_back();
}
int main() {
  scanf("%lld", &n);
  for (int(i) = (int)(1); (i) <= (int)(n); ++(i)) scanf("%lld", &a[i]);
  for (int(i) = (int)(2); (i) <= (int)(n); ++(i)) {
    int p;
    long long w;
    scanf("%d%lld", &p, &w);
    g[p].push_back(make_pair(i, w));
  }
  dfs(1, 0);
  for (int(i) = (int)(1); (i) < (int)(n); ++(i)) printf("%lld ", ans[i]);
  printf("%lld\n", ans[n]);
  return 0;
}
