#include <bits/stdc++.h>
using namespace std;
const int N = 201000;
int n;
int a[N], sta[N], fg[N];
vector<pair<int, int> > s[N];
long long dis[N];
void dfs(int u, long long d, int f) {
  sta[f] = u;
  dis[f] = d;
  int l = lower_bound(dis, dis + f + 1, d - a[u]) - dis - 1;
  fg[sta[l]]--;
  fg[u]++;
  for (auto v : s[u]) {
    dfs(v.first, d + v.second, f + 1);
    fg[u] += fg[v.first];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  int p, w;
  for (int i = 2; i <= n; ++i) {
    scanf("%d%d", &p, &w);
    s[p].push_back(make_pair(i, w));
  }
  dis[0] = (-1ll) << 60;
  dfs(1, 0, 1);
  for (int i = 1; i <= n; ++i) printf("%d ", fg[i] - 1);
  putchar('\n');
  return 0;
}
