#include <bits/stdc++.h>
using namespace std;
vector<int> v[200005];
long long a[200005], w[200005];
int ans[200005], p[200005];
vector<int> pp;
vector<long long> s;
void dfs(int u, long long len) {
  len += w[u];
  int h = lower_bound(s.begin(), s.end(), len - a[u]) - s.begin();
  if (h < s.size()) {
    ans[p[u]]++;
    ans[p[pp[h]]]--;
  }
  pp.push_back(u);
  s.push_back(len);
  for (int i = 0; i < v[u].size(); i++) {
    dfs(v[u][i], len);
    ans[u] += ans[v[u][i]];
  }
  pp.pop_back();
  s.pop_back();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    cin >> p[i] >> w[i];
    v[p[i]].push_back(i);
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
