#include <bits/stdc++.h>
using namespace std;
long long n, a[200005], used[200005], h[200005], k[200005], p[200005][20],
    d[200005], c[200005], cnt(0), kq[200005];
vector<pair<int, int> > s[200005];
void DFS(int u) {
  used[u] = 1;
  for (auto v : s[u]) {
    if (!used[v.first]) {
      h[v.first] = h[u] + v.second;
      k[v.first] = k[u] + 1;
      DFS(v.first);
    }
  }
}
void DFS1(int u) {
  for (auto v : s[u])
    if (v.first != p[u][0]) {
      p[v.first][0] = u;
      for (int i = 1; i <= 17; i++) p[v.first][i] = p[p[v.first][i - 1]][i - 1];
      DFS1(v.first);
    }
}
void DFS2(int u) {
  used[u] = 1;
  for (auto v : s[u]) {
    if (!used[v.first]) {
      DFS2(v.first);
      kq[u] += kq[v.first];
    }
  }
}
int LCA(int u, int d) {
  for (int i = 0; i <= 17; i++)
    if ((d >> i) & 1) u = p[u][i];
  return u;
}
void READ() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int p, w;
    cin >> p >> w;
    s[p].push_back({i + 1, w});
    s[i + 1].push_back({p, w});
  }
  DFS(1);
  DFS1(1);
  h[0] = 1e9;
  for (int i = 2; i <= n; i++) {
    int lo = 0, hi = k[i];
    while (lo <= hi) {
      int mid = (lo + hi) / 2;
      int t = LCA(i, mid);
      if (h[i] - h[t] <= a[i]) {
        lo = mid + 1;
      } else
        hi = mid - 1;
    }
    int t = LCA(i, hi);
    kq[p[t][0]]--;
    kq[p[i][0]]++;
  }
  memset(used, 0, sizeof(used));
  DFS2(1);
  for (int i = 1; i <= n; i++) cout << kq[i] << " ";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  READ();
  return 0;
}
