#include <bits/stdc++.h>
using namespace std;
const int mx = 200005;
int ara[mx], cnt[mx], ans[mx];
vector<pair<int, long long> > edges[mx];
vector<pair<int, long long> > stk;
vector<pair<int, long long> >::iterator it;
bool compare(pair<int, long long> A, pair<int, long long> B) {
  return A.second < B.second;
}
int dfs(int p, int u, long long dist) {
  pair<int, long long> temp;
  temp.first = u;
  temp.second = dist - ara[u];
  stk.push_back(make_pair(u, dist));
  it = lower_bound(stk.begin(), stk.end(), temp, compare);
  if (it != stk.begin() && it != stk.end()) {
    it--;
    if (p != it->first) cnt[it->first]++;
  }
  int i, v, m;
  m = edges[u].size();
  for (i = 0; i < m; i++) {
    v = edges[u][i].first;
    if (edges[u][i].second <= ara[v]) ans[u]++;
    ans[u] += dfs(u, v, dist + edges[u][i].second);
  }
  stk.pop_back();
  ans[u] -= cnt[u];
  return ans[u];
}
int main() {
  int i, n, u, w;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &ara[i]);
  for (i = 2; i <= n; i++) {
    scanf("%d %d", &u, &w);
    edges[u].push_back(make_pair(i, w));
  }
  dfs(0, 1, 0);
  for (i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
