#include <bits/stdc++.h>
using namespace std;
int ans = 0;
long long arr[100010], p;
int vis[100010];
list<pair<int, long long> > queu[100010];
void dfs(int v, int d, int x) {
  vis[v] = 1;
  ans += x;
  for (list<pair<int, long long> >::iterator e = queu[v].begin();
       e != queu[v].end(); ++e) {
    int vn = (*e).first;
    if (vis[vn]) continue;
    long long dn = max(d, 0) + (*e).second;
    int xn = x;
    if (dn > arr[vn]) xn = 1;
    dfs(vn, dn, xn);
  }
}
int main() {
  int n, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> p;
    queu[i + 1].push_back(make_pair(x - 1, p));
    queu[x - 1].push_back(make_pair(i + 1, p));
  }
  arr[0] = 0;
  dfs(0, 0, 0);
  cout << ans;
  return 0;
}
