#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, val[N], ans[N];
long long dep[N];
vector<pair<long long, int> > path;
vector<pair<int, long long> > e[N];
void dfs(int u) {
  ans[u]++;
  int p =
      lower_bound(path.begin(), path.end(), make_pair(dep[u] - val[u], -1)) -
      path.begin();
  p--;
  if (p >= 0) ans[path[p].second]--;
  path.push_back(make_pair(dep[u], u));
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i].first;
    dep[v] = dep[u] + e[u][i].second;
    dfs(v);
    ans[u] += ans[v];
  }
  path.pop_back();
}
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n) {
    memset(ans, 0, sizeof(ans));
    memset(dep, 0, sizeof(dep));
    for (int i = 1; i <= n; i++) e[i].clear();
    for (int i = 1; i <= n; i++) cin >> val[i];
    int pre;
    long long l;
    for (int i = 2; i <= n; i++) {
      cin >> pre >> l;
      e[pre].push_back(make_pair(i, l));
    }
    dfs(1);
    for (int i = 1; i < n; i++) cout << ans[i] - 1 << " ";
    cout << ans[n] - 1 << endl;
  }
  return 0;
}
