#include <bits/stdc++.h>
using namespace std;
vector<int> a;
vector<vector<pair<int, int>>> g;
vector<long long> d;
void dfs1(int v) {
  for (size_t i = 0; i < g[v].size(); ++i) {
    int to = g[v][i].first;
    int w = g[v][i].second;
    d[to] = d[v] + w;
    dfs1(to);
  }
}
vector<int> path;
vector<long long> pathd;
vector<int> part;
void dfs2(int v) {
  path.push_back(v);
  pathd.push_back(d[v]);
  size_t index =
      lower_bound(pathd.begin(), pathd.end(), d[v] - a[v]) - pathd.begin();
  if (index < pathd.size() - 1) {
    if (index > 0) {
      --part[path[index - 1]];
    }
    if (pathd.size() > 1) {
      ++part[path[pathd.size() - 2]];
    }
  }
  for (auto p : g[v]) {
    dfs2(p.first);
  }
  path.pop_back();
  pathd.pop_back();
}
vector<int> cnt;
int dfs3(int v) {
  int s = 0;
  for (auto p : g[v]) {
    s += dfs3(p.first);
  }
  return cnt[v] = s + part[v];
}
int main() {
  int n;
  scanf("%d", &n);
  a.resize(n);
  g.resize(n);
  d.resize(n);
  part.resize(n, 0);
  cnt.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i < n; ++i) {
    int p, w;
    scanf("%d%d", &p, &w);
    --p;
    g[p].push_back(make_pair(i, w));
  }
  d[0] = 0;
  dfs1(0);
  dfs2(0);
  dfs3(0);
  for (int i = 0; i < n; ++i) {
    printf("%d ", cnt[i]);
  }
  printf("\n");
  return 0;
}
