#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> G[200001];
vector<pair<long long, int>> l;
long long a[200001], b[200001];
long long ans[200001], n;
void f(int x) {
  ans[x]++;
  long long p = lower_bound(l.begin(), l.end(), make_pair(b[x] - a[x], -1)) -
                l.begin() - 1;
  if (p >= 0) ans[l[p].second]--;
  l.push_back(make_pair(b[x], x));
  for (auto& v : G[x]) {
    b[v.first] = b[x] + v.second;
    f(v.first);
    ans[x] += ans[v.first];
  }
  l.pop_back();
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    int p, w;
    cin >> p >> w;
    G[p].push_back(make_pair(i, w));
  }
  f(1);
  for (int i = 1; i <= n; i++)
    printf("%lld%c", ans[i] - 1, ((i == n) ? '\n' : ' '));
  return 0;
}
