#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int par[20][N + 1], lvl[N + 1], val[N + 1];
int arr[N + 1];
long long dist[N + 1];
vector<pair<int, int> > adj[N + 1];
void dfs(int s, int p) {
  par[0][s] = p;
  for (auto nbr : adj[s]) {
    if (nbr.first != p) {
      lvl[nbr.first] = lvl[s] + 1;
      dist[nbr.first] = dist[s] + nbr.second;
      dfs(nbr.first, s);
    }
  }
}
void dfs2(int s, int p) {
  for (auto nbr : adj[s]) {
    if (nbr.first != p) {
      dfs2(nbr.first, s);
      val[s] += val[nbr.first];
    }
  }
}
int lca(int v1, int v2) {
  if (lvl[v1] < lvl[v2]) swap(v1, v2);
  int diff = lvl[v1] - lvl[v2], p = 0;
  while (diff) {
    if (diff & 1) v1 = par[p][v1];
    diff >>= 1;
    p++;
  }
  if (v1 == v2) return v1;
  for (int go = 19; go >= 0; go--) {
    if (par[go][v1] != par[go][v2]) {
      v1 = par[go][v1];
      v2 = par[go][v2];
    }
  }
  return par[0][v1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 2; i <= n; i++) {
    int u, w;
    cin >> u >> w;
    adj[u].push_back({i, w});
    adj[i].push_back({u, w});
  }
  adj[0].push_back({1, 1});
  dfs(0, -1);
  for (int d = 1; d < 20; d++) {
    for (int i = 0; i <= n; i++) {
      int mid = par[d - 1][i];
      if (mid == -1)
        par[d][i] = -1;
      else
        par[d][i] = par[d - 1][mid];
    }
  }
  for (int i = 2; i <= n; i++) {
    int curr = i;
    for (int j = 19; j >= 0; j--) {
      if (par[j][curr] != -1 &&
          dist[i] - dist[par[j][curr]] <= (long long)arr[i]) {
        curr = par[j][curr];
      }
    }
    if (curr == 0) curr = 1;
    int u = curr;
    if (u == i) continue;
    int v = par[0][i];
    int lc = lca(u, v);
    val[u] += 1;
    val[v] += 1;
    val[par[0][lc]] -= 1;
    val[lc] -= 1;
  }
  dfs2(0, -1);
  for (int i = 1; i <= n; i++) {
    cout << val[i] << ' ';
  }
  return 0;
}
