#include <bits/stdc++.h>
using namespace std;
struct edge {
  int to, w, next;
} edge[2000050];
int head[2000050], ptr;
void add_edge(int from, int to, int w) {
  edge[++ptr].to = to;
  edge[ptr].next = head[from];
  edge[ptr].w = w;
  head[from] = ptr;
}
struct NODE {
  bool type;
  int index;
  long long val;
} node[2000050 << 1];
int cnt, tot;
long long tree[2000050];
int lowbit(int x) { return x & -x; }
void add(int x, int v) {
  for (; x <= 2000050; x += lowbit(x)) tree[x] += v;
}
long long query(int x) {
  long long res = 0;
  for (; x; x -= lowbit(x)) res += tree[x];
  return res;
}
long long query(int x, int y) { return query(y) - query(x - 1); }
long long a[2000050];
int in[2000050], out[2000050];
long long deep[2000050];
void dfs(int now) {
  in[now] = ++tot;
  for (int p = head[now]; p; p = edge[p].next) {
    int to = edge[p].to;
    deep[to] = deep[now] + edge[p].w;
    dfs(to);
  }
  out[now] = tot;
}
bool cmp(NODE a, NODE b) {
  if (a.val == b.val) return a.type && !b.type;
  return a.val < b.val;
}
int ans[2000050];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    add_edge(a, i, b);
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    node[cnt++] = NODE{false, i, deep[i]};
    node[cnt++] = NODE{true, i, deep[i] - a[i]};
  }
  sort(node, node + cnt, cmp);
  for (int i = 0; i < cnt; i++) {
    int idx = node[i].index;
    if (node[i].type)
      add(in[idx], 1);
    else
      ans[idx] = query(in[idx] + 1, out[idx]);
  }
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
}
