#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
int n, p;
long long a[N], weight;
long long pre[N], fn[N];
vector<pair<int, long long> > g[N];
multiset<pair<long long, int> > have;
void dfs(int u, long long cost) {
  have.insert(make_pair(cost, u));
  multiset<pair<long long, int> >::iterator it =
      have.lower_bound(make_pair(cost - a[u], 0));
  pre[u]++;
  if (it != have.end()) {
    pre[(*it).second]--;
  }
  for (int i = 0; i < g[u].size(); ++i) {
    dfs(g[u][i].first, cost + g[u][i].second);
  }
  have.erase(have.find(make_pair(cost, u)));
}
void sum(int u) {
  fn[u] = 0;
  for (int i = 0; i < g[u].size(); ++i) {
    int v = g[u][i].first;
    sum(v);
    fn[u] += pre[v];
  }
  pre[u] += fn[u];
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  for (int i = 2; i <= n; ++i) {
    scanf("%d%lld", &p, &weight);
    g[p].push_back(make_pair(i, weight));
  }
  dfs(1, 0);
  sum(1);
  for (int i = 1; i <= n; ++i) {
    if (i > 1) printf(" ");
    printf("%lld", fn[i]);
  }
  puts("");
  return 0;
}
