#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long uint64;
const long long maxn = (long long)2e5 + 100;
const long long maxm = (long long)25;
const int LOGN = 22;
const long long INF = 2e9 + 10;
const double PI = acos(-1.0);
const long long MOD = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  while (cin >> n) {
    vector<long long> a(n);
    for (int i = (0); i < ((n)); ++i) cin >> a[i];
    vector<vector<pair<long long, long long> > > g(n);
    for (int i = (0); i < ((n - 1)); ++i) {
      int p, w;
      cin >> p >> w;
      --p;
      g[p].push_back({i + 1, w});
    }
    vector<long long> d(n);
    vector<long long> ans(n, 0);
    vector<pair<long long, long long> > path;
    function<void(int, int)> Dfs = [&](int x, int fa) {
      path.push_back({d[x], x});
      long long dist = d[x] - a[x];
      int ind =
          upper_bound((path).begin(), (path).end(), make_pair(dist, -1LL)) -
          path.begin();
      --ind;
      if (ind >= 0) {
        ans[path[ind].second] -= 1;
      }
      ans[x] += 1;
      for (auto e : g[x])
        if (e.first != fa) {
          int y = e.first;
          long long w = e.second;
          d[y] = d[x] + w;
          Dfs(y, x);
          ans[x] += ans[y];
        }
      path.pop_back();
    };
    Dfs(0, 0);
    for (int i = (0); i < ((n)); ++i) cout << ans[i] - 1 << " ";
    cout << endl;
  }
  return 0;
}
