#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ch = getchar(), f = 1, ans = 0;
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = 0;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    ans = (((ans << 2) + ans) << 1) + (ch ^ '0');
  return f ? ans : -ans;
}
const int MAXN = 2e5 + 5;
vector<pair<long long, int> > G[MAXN], path;
long long dep[MAXN];
int sum[MAXN], a[MAXN];
void dfs(int u) {
  path.push_back(make_pair(dep[u], u));
  int it = lower_bound(path.begin(), path.end(), make_pair(dep[u] - a[u], -1)) -
           path.begin() - 1;
  if (it >= 0) sum[path[it].second]--;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i].first, w = G[u][i].second;
    dep[v] = dep[u] + w;
    dfs(v);
    sum[u] += sum[v] + 1;
  }
  path.pop_back();
}
int main() {
  int n;
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 2; i <= n; i++) {
    int t = read(), w = read();
    G[t].push_back(make_pair(i, w));
  }
  dep[1] = 0;
  dfs(1);
  for (int i = 1; i <= n; i++) printf("%d ", sum[i]);
  return 0;
}
