#include <bits/stdc++.h>
using namespace std;
const long long inf = 1LL << 61;
const long long mod = 1000000007;
const int max_n = 200010;
int arr[max_n], sum[max_n];
long long dist[max_n];
vector<pair<long long, int> > G[max_n], path;
void dfs(int u);
int main() {
  int i = 0, j = 0, k = 0;
  int n, a, w;
  memset(dist, 0, sizeof(dist)), memset(sum, 0, sizeof(sum));
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
  }
  for (i = 2; i <= n; i++) {
    scanf("%d%d", &a, &w);
    G[a].push_back(make_pair(i, w));
  }
  dfs(1);
  for (i = 1; i <= n; i++) {
    printf("%d%c", sum[i], i != n ? ' ' : '\n');
  }
  return 0;
}
void dfs(int u) {
  path.push_back(make_pair(dist[u], u));
  int it =
      lower_bound(path.begin(), path.end(), make_pair(dist[u] - arr[u], -1)) -
      path.begin() - 1;
  if (it >= 0) {
    sum[path[it].second]--;
  }
  int i, v;
  for (i = 0; i < G[u].size(); i++) {
    v = G[u][i].first;
    dist[v] = dist[u] + G[u][i].second;
    dfs(v);
    sum[u] += sum[v] + 1;
  }
  path.pop_back();
}
