#include <bits/stdc++.h>
using namespace std;
const int maxn = 200001;
int n;
vector<int> lmt, ans;
vector<long long> dist;
vector<pair<long long, int>> path;
vector<vector<pair<int, int>>> chd;
void dfs(int v) {
  ans[v]++;
  if (dist[v]) {
    int p = lower_bound(path.begin(), path.end(),
                        make_pair((long long)dist[v] - lmt[v], -1)) -
            path.begin();
    if (p > 0) ans[path[p - 1].second]--;
  }
  path.push_back({dist[v], v});
  for (auto c : chd[v]) {
    dist[c.first] = dist[v] + c.second;
    dfs(c.first);
    ans[v] += ans[c.first];
  }
  path.pop_back();
}
int main() {
  int n, p, w;
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> n;
  lmt.resize(n + 2);
  ans.resize(n + 2);
  chd.resize(n + 2);
  dist.resize(n + 2);
  for (int i = 1; i < n + 1; i++) cin >> lmt[i];
  for (int i = 2; i < n + 1; i++) {
    cin >> p >> w;
    chd[p].push_back({i, w});
  }
  dfs(1);
  for (int i = 1; i < n + 1; i++) cout << ans[i] - 1 << " ";
  cout << endl;
  return 0;
}
