#include <bits/stdc++.h>
using namespace std;
int n;
int a[200000 + 9];
int parentCost[200000 + 9];
long long rootCost[200000 + 9];
vector<vector<int> > edges(200000 + 9);
int x[200000 + 9], ans[200000 + 9];
vector<int> path;
void dfs(int u, long long curCost) {
  rootCost[u] = curCost;
  int s = 0, e = path.size() - 1, far = -1;
  while (s <= e) {
    int k = (s + e) / 2;
    int v = path[k];
    if (rootCost[u] - rootCost[v] <= a[u])
      far = k, e = k - 1;
    else
      s = k + 1;
  }
  if (far != -1) {
    x[*path.rbegin()]++;
    if (far != 0) x[path[far - 1]]--;
  }
  int val = 0;
  path.push_back(u);
  for (int i = 0; i < (int)edges[u].size(); i++) {
    int child = edges[u][i];
    dfs(child, curCost + parentCost[child]);
    val += ans[child];
  }
  val += x[u];
  path.pop_back();
  ans[u] = val;
}
void init() {
  cin.tie(0);
  cin.sync_with_stdio(0);
}
int main() {
  init();
  cin >> n;
  for (int i = (1); i <= (n); i++) cin >> a[i];
  for (int i = (2); i <= (n); i++) {
    int parent;
    cin >> parent >> parentCost[i];
    edges[parent].push_back(i);
  }
  dfs(1, 0);
  for (int i = (1); i <= (n); i++) cout << ans[i] << " ";
  cout << '\n';
  return 0;
}
