#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
vector<pair<long long, int> > g[maxn];
int u, w, a[maxn], sz[maxn], up[maxn][21];
long long h[maxn];
vector<pair<long long, int> > vec;
void DFS(int u, int p = 0) {
  if (p == 0) h[u] = 0;
  up[u][0] = (p ? p : -1);
  for (int i = 1; i <= 20; ++i)
    if (up[u][i - 1] + 1) up[u][i] = up[up[u][i - 1]][i - 1];
  for (pair<long long, int> x : g[u]) {
    h[x.first] = h[u] + x.second;
    DFS(x.first, u);
  }
}
void DFS2(int u, int p = 0) {
  int tmp = u;
  for (int i = 20; i >= 0; --i) {
    if (up[tmp][i] + 1 && h[u] - h[up[tmp][i]] <= a[u]) {
      tmp = up[tmp][i];
    }
  }
  tmp = up[tmp][0];
  if (tmp >= 1) --sz[tmp];
  ++sz[u];
  for (pair<long long, int> x : g[u]) {
    DFS2(x.first, u);
  }
}
void DFS3(int u, int p) {
  for (pair<long long, int> x : g[u]) {
    DFS3(x.first, u);
    sz[u] += sz[x.first];
  }
}
int main() {
  int n;
  cin >> n;
  memset(up, -1, sizeof up);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 2; i <= n; ++i) {
    scanf("%d %d", &u, &w);
    g[u].push_back({i, w});
  }
  DFS(1);
  DFS2(1);
  DFS3(1, 0);
  for (int i = 1; i <= n; ++i) printf("%d ", sz[i] - 1);
}
