#include <bits/stdc++.h>
using namespace std;
int64_t dis[200001];
int n, p, nd, a[200001], dpt[200001], ans[200001], P[200001][19];
vector<int> G[200001];
void dfs(int i, int p) {
  dis[i] += dis[p];
  dpt[i] = dpt[p] + 1;
  P[i][0] = p;
  for (int j = 1; j < 19; ++j) P[i][j] = P[P[i][j - 1]][j - 1];
  for (auto j : G[i]) dfs(j, i);
}
void dfs2(int i) {
  for (auto j : G[i]) {
    dfs2(j);
    ans[i] += ans[j];
  }
}
bool f(int x, int i) {
  int k = i;
  for (int j = 18; j >= 0; --j)
    if ((x >> j) & 1) i = P[i][j];
  nd = i;
  return dis[k] - dis[i] <= a[k];
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 2; i <= n; ++i) {
    cin >> p >> dis[i];
    G[p].push_back(i);
  }
  dfs(1, 0);
  for (int i = 1; i <= n; ++i) {
    int st = 0, en = dpt[i], md, tmp = i;
    while (st <= en) {
      md = (st + en) / 2;
      if (f(md, i))
        tmp = nd, st = md + 1;
      else
        en = md - 1;
    }
    ++ans[P[i][0]];
    --ans[P[tmp][0]];
  }
  dfs2(1);
  for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
}
