#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int64_t LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MAX = 2e5 + 10;
int N;
vector<int64_t> A, D;
vector<pair<int64_t, int> > g[MAX];
vector<int> pai[20], att;
int getKth(int v, int k) {
  int msb = -1, kk = k;
  while (kk) msb++, kk >>= 1;
  int at = v;
  for (int i = msb; i >= 0; i--) {
    if (k >> i & 1) at = pai[i][at];
  }
  return at;
}
int busca(int v) {
  int l = 1, r = N;
  while (l < r) {
    int m = l + (r - l) / 2;
    int p = getKth(v, m);
    if (p == N || D[v] - D[p] > A[v])
      r = m;
    else
      l = m + 1;
  }
  return l;
}
void dfs(int v) {
  for (auto [w, u] : g[v]) {
    if (u == pai[0][v]) continue;
    D[u] = D[v] + w;
    dfs(u);
  }
  int far = busca(v);
  att[getKth(v, far)]--;
  att[getKth(v, 1)]++;
}
void dfs2(int v) {
  for (auto [w, u] : g[v]) {
    if (u == pai[0][v]) continue;
    dfs2(u);
    att[v] += att[u];
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N;
  A.resize(N);
  D.assign(N, 0ll);
  for (auto& qw : (A)) cin >> qw;
  ;
  pai[0].resize(N + 1);
  pai[0][0] = N;
  pai[0][N] = N;
  for (int i = 1; i < N; i++) {
    int v, w;
    cin >> v >> w;
    v--;
    pai[0][i] = v;
    g[i].push_back({w, v});
    g[v].push_back({w, i});
  }
  for (int i = 1; i < 20; i++) {
    pai[i].resize(N + 1);
    for (int v = 0; v <= N; v++) {
      pai[i][v] = pai[i - 1][pai[i - 1][v]];
    }
  }
  att.assign(N + 1, 0);
  dfs(0);
  dfs2(0);
  att.pop_back();
  for (auto& qw : (att)) cout << qw << " ";
  cout << '\n';
  ;
  return 0;
}
