#include <bits/stdc++.h>
using namespace std;
int n;
vector<long long> a;
vector<long long> w;
vector<vector<int> > ot;
vector<long long> vz;
vector<vector<int> > deti;
vector<long long> vel_sub;
vector<int> zle;
vector<int> kolko;
int dfs(int kde) {
  int suc = 0;
  for (int dieta : deti[kde]) {
    vz[dieta] = vz[kde] + w[dieta];
    int p_deti = dfs(dieta);
    suc += p_deti;
  }
  vel_sub[kde] = suc;
  return suc + 1;
}
void otec() {
  bool novy = true;
  int k = 0;
  while (novy) {
    novy = false;
    for (int i = 0; i < n; ++i) {
      if (ot[i][k] == -1) {
        ot[i].push_back(-1);
        continue;
      }
      int predok = ot[i][k];
      int predok_predka = ot[predok][k];
      ot[i].push_back(predok_predka);
      novy = true;
    }
    k++;
  }
}
bool sedi(int otec, int syn) {
  if (otec == -1) return false;
  long long da = vz[otec];
  long long db = vz[syn];
  long long dis = db - da;
  return (dis <= a[syn]);
}
int ktoze(int kde) {
  int dolny = ot[kde][0];
  if (!sedi(dolny, kde)) return dolny;
  int k = ot[dolny].size() - 1;
  while (k > 0) {
    k--;
    if (sedi(ot[dolny][k], kde)) {
      dolny = ot[dolny][k];
    } else {
      continue;
    }
  }
  return ot[dolny][k];
}
void vypln_zle() {
  for (int i = 1; i < n; ++i) {
    int kto = ktoze(i);
    if (kto == -1) continue;
    zle[kto]++;
  }
}
int answer(int kde) {
  int suc = zle[kde];
  for (int dieta : deti[kde]) {
    int kolko_zle = answer(dieta);
    suc += kolko_zle;
  }
  kolko[kde] = suc;
  return suc;
}
int main() {
  scanf("%d", &n);
  ot.resize(n, vector<int>());
  a.resize(n);
  vz.resize(n);
  w.resize(n);
  deti.resize(n, vector<int>());
  vel_sub.resize(n, 0);
  kolko.resize(n, 0);
  zle.resize(n, 0);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  int root = 0;
  ot[root].push_back(-1);
  for (int i = 1; i < n; ++i) {
    int pi;
    scanf("%d %I64d", &pi, &w[i]);
    pi--;
    ot[i].push_back(pi);
    deti[pi].push_back(i);
  }
  vz[root] = 0;
  dfs(root);
  otec();
  vypln_zle();
  answer(root);
  for (int i = 0; i < n; ++i) {
    printf("%I64d%c", vel_sub[i] - kolko[i], (i < n - 1) ? ' ' : '\n');
  }
  return 0;
}
