#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
vector<int> e[N];
int a[N], p[N], w[N];
int ans[N];
vector<long long> sum;
vector<int> ps;
int n;
void dfs(int v, long long len) {
  len += w[v];
  int t = lower_bound(sum.begin(), sum.end(), len - a[v]) - sum.begin();
  if (t < sum.size()) {
    ans[p[v]]++;
    ans[p[ps[t]]]--;
  }
  ps.push_back(v);
  sum.push_back(len);
  for (auto u : e[v]) {
    dfs(u, len);
    ans[v] += ans[u];
  }
  sum.pop_back();
  ps.pop_back();
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 2; i <= n; ++i) {
    scanf("%d%d", p + i, w + i);
    e[p[i]].push_back(i);
  }
  dfs(1, 0);
  for (int i = 1; i <= n; ++i) printf("%d%c", ans[i], " \n"[i == n]);
  return 0;
}
