#include <bits/stdc++.h>
using namespace std;
const int mx = 2e5 + 10;
const long long mod = 1e9 + 7;
int n, m;
long long a[mx], w[mx], dis[mx];
int cf[mx], p[mx];
vector<int> vec[mx];
int vc[mx], cnt = 0;
void dfs(int u) {
  for (int v : vec[u]) {
    dis[v] = dis[u] + w[v];
    int l = 1, r = cnt;
    while (l <= r) {
      int mid = l + r >> 1;
      if (dis[vc[mid]] >= dis[v] - a[v]) {
        r = mid - 1;
      } else
        l = mid + 1;
    }
    vc[++cnt] = v;
    if (vc[l] != 1) cf[p[vc[l]]] -= 1;
    cf[p[v]] += 1;
    dfs(v);
    --cnt;
  }
}
void dfs2(int u) {
  for (int v : vec[u]) {
    dfs2(v);
    cf[u] += cf[v];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &a[i]);
  }
  for (int i = 2; i <= n; ++i) {
    scanf("%d%I64d", &p[i], &w[i]);
    vec[p[i]].push_back(i);
  }
  vc[++cnt] = 1;
  dfs(1);
  dfs2(1);
  for (int i = 1; i <= n; ++i) {
    printf("%d ", cf[i]);
  }
}
