#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200001;
int n;
int a[MAXN];
vector<pair<int, int> > g[MAXN];
long long inord[MAXN];
long long dist[MAXN];
int ordsz = 0;
int bl[MAXN], br[MAXN];
void dfs(int v, long long d = 0) {
  dist[v] = d;
  bl[v] = ordsz;
  inord[ordsz++] = d - a[v];
  for (auto to : g[v]) {
    dfs(to.first, d + to.second);
  }
  br[v] = ordsz - 1;
}
long long* t[4 * MAXN];
long long vals[MAXN * 21];
long long* lastv = vals;
void build(int tl, int tr, int v) {
  if (tl == tr) {
    t[v] = lastv;
    t[v][0] = inord[tl];
    lastv++;
    return;
  }
  int tm = (tl + tr) / 2;
  build(tl, tm, 2 * v);
  build(tm + 1, tr, 2 * v + 1);
  merge(t[2 * v], t[2 * v] + tm - tl + 1, t[2 * v + 1], t[2 * v + 1] + tr - tm,
        lastv);
  t[v] = lastv;
  lastv += tr - tl + 1;
}
int fndres(int tl, int tr, int v, int l, int r, long long av) {
  if (l > r) return 0;
  if (tl == l && tr == r) {
    return (int)(upper_bound(t[v], t[v] + tr - tl + 1, av) - t[v]);
  }
  int tm = (tl + tr) / 2;
  return fndres(tl, tm, 2 * v, l, min(r, tm), av) +
         fndres(tm + 1, tr, 2 * v + 1, max(l, tm + 1), r, av);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < n; i++) {
    int p, w;
    cin >> p >> w;
    g[p - 1].push_back(make_pair(i, w));
  }
  dfs(0);
  build(0, n - 1, 1);
  for (int i = 0; i < n; i++) {
    cout << fndres(0, n - 1, 1, bl[i] + 1, br[i], dist[i]) << " ";
  }
}
