#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const int N = (int)1e6;
vector<pair<long long, int> > path;
vector<vector<pair<int, long long> > > g(N);
long long ans[N], a[N], depth[N];
void dfs(int v, int p = -1) {
  ans[v] = 1;
  int idx =
      lower_bound(path.begin(), path.end(), make_pair(depth[v] - a[v], -1)) -
      path.begin();
  --idx;
  if (idx >= 0) ans[path[idx].second]--;
  path.push_back(make_pair(depth[v], v));
  for (auto x : g[v]) {
    int to = x.first;
    if (to == p) continue;
    long long len = x.second;
    depth[to] = depth[v] + len;
    dfs(to, v);
    ans[v] += ans[to];
  }
  path.pop_back();
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int p;
    long long w;
    cin >> p >> w;
    g[i + 1].push_back(make_pair(p, w));
    g[p].push_back(make_pair(i + 1, w));
  }
  dfs(1);
  for (int i = 1; i <= n; i++) cout << ans[i] - 1 << " ";
  return 0;
}
