#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1, LOGN = 20;
vector<pair<int, long long> > adj[N];
long long a[N], dis[N];
int lca[N][LOGN];
int upd[N];
void dfs1(int u, long long d = 0, int par = 0) {
  dis[u] = d;
  lca[u][0] = par;
  for (int i = 1; i < LOGN; i++) lca[u][i] = lca[lca[u][i - 1]][i - 1];
  long long del = dis[u] - a[u];
  int v = u;
  for (int i = LOGN - 1; i >= 0; i--) {
    if (dis[lca[v][i]] >= del) v = lca[v][i];
  }
  if (v != 0) {
    v = lca[v][0];
    upd[v]--;
  }
  for (auto& ch : adj[u]) {
    dfs1(ch.first, d + ch.second, u);
    upd[u] += upd[ch.first];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    int p, w;
    cin >> p >> w;
    adj[p - 1].emplace_back(i + 1, w);
  }
  fill(upd, upd + n, 1);
  dfs1(0);
  for (int i = 0; i < n; i++) cout << upd[i] - 1 << ' ';
  cout << endl;
  return 0;
}
