#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
vector<pair<long long, long long> > adj[N];
long long ans, a[N], cnt[N];
void dfs(long long u, long long par = 0) {
  cnt[u] = 1;
  for (auto &v : adj[u]) {
    long long to = v.first;
    if (par == to) {
      continue;
    }
    dfs(to, u);
    cnt[u] += cnt[to];
  }
}
void dfs2(long long u, long long minLen, long long prefLen, long long par = 0) {
  for (auto &v : adj[u]) {
    long long to = v.first, w = v.second;
    if (to == par) {
      continue;
    }
    long long new_minLen = min(minLen, prefLen + w);
    long long curLen = (prefLen + w) - new_minLen;
    if (a[to] < curLen) {
      ans += cnt[to];
    } else {
      dfs2(to, new_minLen, prefLen + w, u);
    }
  }
}
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 2; i <= n; i++) {
    long long v, w;
    cin >> v >> w;
    adj[i].emplace_back(pair<long long, long long>(v, w));
    adj[v].emplace_back(pair<long long, long long>(i, w));
  }
  dfs(1);
  dfs2(1, 0, 0);
  cout << ans;
}
