#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
vector<vector<int>> child;
long long w[maxn], a[maxn], s[maxn], p[maxn], ans[maxn];
void dfs(int now, long long dist, vector<pair<long long, int>> &d) {
  int n = d.size();
  if (n != 0) {
    long long target = dist - a[now];
    int l = 0, r = n - 1;
    while (l < r) {
      int m = (l + r) / 2;
      if (target <= d[m].first)
        r = m;
      else
        l = m + 1;
    }
    if (target <= d[l].first) {
      if (p[d[l].second] != -1) s[p[d[l].second]]--;
      if (p[now] != -1) s[p[now]]++;
    }
  }
  d.push_back({dist, now});
  for (int to : child[now]) {
    dfs(to, dist + w[to], d);
  }
  d.pop_back();
}
void solve(int now) {
  ans[now] = s[now];
  for (int to : child[now]) {
    solve(to);
    ans[now] += ans[to];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  child.resize(n);
  for (int i = 0; i < n; i++) s[i] = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  w[0] = 0;
  p[0] = -1;
  for (int i = 1; i < n; i++) {
    int par;
    long long we;
    cin >> par >> we;
    par--;
    child[par].push_back(i);
    p[i] = par;
    w[i] = we;
  }
  vector<pair<long long, int>> d;
  dfs(0, 0, d);
  solve(0);
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  return 0;
}
