#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 100001;
const int MOD = 1000000007;
const int inf = 1234567890;
const long long INF = 1122334455667788990;
vector<vector<pair<int, int> > > g(N);
vector<int> sz(N), a(N);
int ans = 0;
void go(int u, int p = 0) {
  sz[u] = 1;
  for (auto to : g[u])
    if (to.first != p) {
      go(to.first, u);
      sz[u] += sz[to.first];
    }
}
void dfs(int u, int p = 0, long long mn = 0, long long d = 0) {
  if (d - mn > a[u]) {
    ans += sz[u];
    return;
  }
  for (auto to : g[u])
    if (to.first != p)
      dfs(to.first, u, min(mn, d + (long long)to.second),
          d + (long long)to.second);
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int tc = 1, cs = 0;
  while (tc--) {
    int n, i, u, v;
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 2; i <= n; i++) {
      cin >> u >> v;
      g[u].push_back(make_pair(i, v));
      g[i].push_back(make_pair(u, v));
    }
    go(1);
    dfs(1);
    cout << ans << '\n';
  }
}
