#include <bits/stdc++.h>
const long long INF = (long long)1e18 + 123;
const int inf = (int)2e9 + 123;
const int mod = 1e9 + 7;
using namespace std;
int n;
vector<pair<int, long long> > g[200011];
int d[200011][50];
long long a[200011], ans[200011], up[200011], f[200011];
int dfs(int v, int par = 0) {
  d[v][0] = par;
  for (int i = 1; i <= 30; i++) {
    d[v][i] = d[d[v][i - 1]][i - 1];
  }
  long long h = up[v] - a[v], x = v;
  for (int i = 30; i >= 0; i--) {
    if (d[x][i] == 0) continue;
    if (up[d[x][i]] >= h) {
      x = d[x][i];
    }
  }
  f[d[x][0]]--;
  f[d[v][0]]++;
  long long z = 0;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first, cost = g[v][i].second;
    if (to == par) continue;
    up[to] = up[v] + cost;
    z += dfs(to, v);
  }
  z += f[v];
  ans[v] = z;
  return z;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    g[x].push_back(make_pair(i, y));
  }
  int x = dfs(1);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
