#include <bits/stdc++.h>
using namespace std;
struct Node {
  int l, r, d;
  vector<long long> s;
};
struct Pair {
  int e, w;
};
int n;
const int maxn = 200000 + 10;
vector<int> ch[maxn];
long long d[maxn];
long long a[maxn];
vector<Pair> E[maxn];
int label[maxn], rlabel[maxn];
int lft[maxn], rght[maxn];
int lable_cnt = 0;
int L, R;
long long D;
long long arr[20][maxn];
Node tree[800400];
void build_tree(int v, int l, int r, int dd) {
  tree[v].l = l;
  tree[v].r = r;
  tree[v].d = dd;
  for (int i = l; i <= r; ++i) {
    int tmp = rlabel[i];
    arr[dd][i] = d[tmp] - a[tmp];
  }
  if (l == r) return;
  sort(arr[dd] + l, arr[dd] + r + 1);
  int m = (l + r) >> 1;
  build_tree(v << 1, l, m, dd + 1);
  build_tree(v << 1 | 1, m + 1, r, dd + 1);
}
int query(int v) {
  if (L <= tree[v].l && tree[v].r <= R) {
    long long *ptr = arr[tree[v].d];
    int tmp =
        upper_bound(ptr + tree[v].l, ptr + tree[v].r + 1, D) - ptr - tree[v].l;
    return tmp;
  }
  int ans = 0;
  int m = (tree[v].l + tree[v].r) >> 1;
  if (L <= m) ans += query(v << 1);
  if (m + 1 <= R) ans += query(v << 1 | 1);
  return ans;
}
void dfs(int v, long long dep) {
  d[v] = dep;
  label[v] = ++lable_cnt;
  rlabel[label[v]] = v;
  lft[v] = rght[v] = label[v];
  for (auto e : E[v]) {
    dfs(e.e, dep + e.w);
    lft[v] = min(lft[v], lft[e.e]);
    rght[v] = max(rght[v], rght[e.e]);
  }
}
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 2; i <= n; ++i) {
    Pair pr;
    int p;
    pr.e = i;
    cin >> p >> pr.w;
    E[p].push_back(pr);
  }
  dfs(1, 0);
  build_tree(1, 1, n, 0);
  for (int i = 1; i <= n; ++i) {
    L = lft[i];
    R = rght[i];
    D = d[i];
    cout << query(1) - 1 << " ";
  }
  cout << endl;
}
