#include <bits/stdc++.h>
using namespace std;
inline int readInt() {
  static int n, ch;
  n = 0, ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) n = n * 10 + ch - '0', ch = getchar();
  return n;
}
const int MAX_N = 200000 + 3;
struct edge {
  edge *next;
  int to, cost;
  edge(edge *next = NULL, int to = 0, int cost = 0)
      : next(next), to(to), cost(cost) {}
} pool[MAX_N], *pit = pool, *first[MAX_N];
int n, a[MAX_N], dep[MAX_N];
long long dis[MAX_N];
int anc[20][MAX_N];
int seq[MAX_N], in[MAX_N], out[MAX_N];
void dfs(int u) {
  static int tsp = 0;
  seq[tsp] = u, in[u] = tsp++;
  for (edge *e = first[u]; e; e = e->next) {
    dep[e->to] = dep[u] + 1;
    dis[e->to] = dis[u] + e->cost;
    anc[0][e->to] = u;
    dfs(e->to);
  }
  out[u] = tsp;
}
void process() {
  anc[0][0] = -1;
  dfs(0);
  for (int w = 1; (1 << w) < n; ++w)
    for (int i = 0; i < n; ++i)
      if (dep[i] - (1 << w) >= 0) anc[w][i] = anc[w - 1][anc[w - 1][i]];
}
int mark[MAX_N], s[MAX_N];
void work(int u) {
  if (anc[0][u] != -1) mark[anc[0][u]]++;
  int t = u;
  for (int w = log2(dep[u]); w >= 0; --w)
    if (dep[u] - (1 << w) >= 0 && dis[t] - dis[anc[w][u]] <= a[t])
      u = anc[w][u];
  if (anc[0][u] != -1) mark[anc[0][u]]--;
}
void cal() {
  for (int i = 0; i < n; ++i) s[i + 1] = s[i] + mark[seq[i]];
  for (int i = 0; i < n; ++i)
    printf("%d%c", s[out[i]] - s[in[i]], i + 1 == n ? '\n' : ' ');
}
int main() {
  n = readInt();
  for (int i = 0; i < n; ++i) a[i] = readInt();
  for (int i = 0, u, v, w; i < n - 1; ++i) {
    u = readInt() - 1, v = i + 1, w = readInt();
    first[u] = new (pit++) edge(first[u], v, w);
  }
  process();
  for (int i = 0; i < n; ++i) work(i);
  cal();
  return 0;
}
