#include <bits/stdc++.h>
using namespace std;
int st[200100][20 + 1];
int v[200100], l[200100];
long long int dist[200100], a[200100];
int c[200100];
vector<pair<int, int> > adj[200100];
void dfs(int node) {
  for (int i = 1; i < 20; i++) {
    if (!st[node][i - 1]) break;
    st[node][i] = st[st[node][i - 1]][i - 1];
  }
  v[node] = 1;
  for (int i = 0; i < adj[node].size(); i++) {
    if (!v[adj[node][i].first]) {
      l[adj[node][i].first] = l[node] + 1;
      st[adj[node][i].first][0] = node;
      dist[adj[node][i].first] = dist[node] + adj[node][i].second;
      dfs(adj[node][i].first);
    }
  }
}
void update(int node) {
  v[node] = 1;
  for (int i = 0; i < adj[node].size(); i++) {
    if (!v[adj[node][i].first]) {
      update(adj[node][i].first);
      c[node] += (c[adj[node][i].first]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int p, w;
  c[1] = 0;
  for (int i = 2; i <= n; i++) {
    cin >> p >> w;
    adj[p].push_back(make_pair(i, w));
    adj[i].push_back(make_pair(p, w));
    c[i] = 0;
  }
  dfs(1);
  for (int i = 1; i <= n; i++) v[i] = 0;
  dist[0] = -10000000000000000;
  for (int i = 1; i <= n; i++) {
    int tmp = i;
    for (int j = 20 - 1; j >= 0; j--) {
      if (a[i] >= (dist[i] - dist[st[tmp][j]])) tmp = st[tmp][j];
    }
    c[st[tmp][0]] -= 1;
    c[st[i][0]] += 1;
  }
  update(1);
  for (int i = 1; i <= n; i++) cout << c[i] << " ";
  return 0;
}
