#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long N = 3e5 + 100;
const long long big = 6e18;
long long block = 800;
const long long mod = 1e6;
long long n;
vector<pair<long long, long long> > g[N];
long long bin[N][31];
long long a[N];
long long p[N];
long long C[N];
long long gl[N];
long long ans[N];
long long pod[N];
void data() {}
void pdfs(long long v = 1, long long cen = 0, long long gp = 0,
          long long P = 0) {
  gl[v] = gp;
  bin[v][0] = P;
  C[v] = cen;
  for (int i = 1; i <= 20; i++) bin[v][i] = bin[bin[v][i - 1]][i - 1];
  for (auto u : g[v]) pdfs(u.first, cen + u.second, gp + 1, v);
}
void dfs(long long v = 1) {
  long long cur = v;
  for (int i = 20; i >= 0; i--) {
    if (bin[cur][i] == 0) continue;
    long long x = C[v] - C[bin[cur][i]];
    if (x <= a[v]) cur = bin[cur][i];
  }
  ans[p[cur]]--;
  ans[p[v]]++;
  for (auto u : g[v]) {
    dfs(u.first);
    ans[v] += ans[u.first];
  }
}
int main() {
  data();
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    long long xz, wz;
    cin >> xz >> wz;
    p[i] = xz;
    g[xz].push_back(make_pair(i, wz));
  }
  pdfs();
  dfs();
  for (int i = 1; i <= n; ++i) cout << ans[i] << " ";
}
