#include <bits/stdc++.h>
using namespace std;
long long cnt = 0;
map<pair<long long, long long>, long long> m;
void dfs(long long x, vector<long long> v[], bool vis[], long long flag,
         long long sum[], long long val[]) {
  if (vis[x] == false) vis[x] = true;
  for (long long i = 0; i < v[x].size(); i++) {
    if (vis[v[x][i]] == false) {
      vis[v[x][i]] = true;
      if (sum[x] < 0) sum[x] = 0;
      sum[v[x][i]] = sum[x] + m[{min(x, v[x][i]), max(x, v[x][i])}];
      if (flag == 0) {
        if (sum[v[x][i]] > val[v[x][i]]) {
          cnt++;
          dfs(v[x][i], v, vis, 1, sum, val);
        } else {
          dfs(v[x][i], v, vis, 0, sum, val);
        }
      } else {
        cnt++;
        dfs(v[x][i], v, vis, 1, sum, val);
      }
    }
  }
}
signed main() {
  long long n;
  cin >> n;
  long long val[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> val[i];
  }
  vector<long long> v[n + 1];
  long long a, b;
  for (long long i = 2; i <= n; i++) {
    cin >> a >> b;
    v[i].push_back(a);
    v[a].push_back(i);
    m[{min(i, a), max(i, a)}] = b;
  }
  long long sum[n + 1];
  sum[1] = 0;
  bool vis[n + 1];
  memset(vis, 0, sizeof(vis));
  dfs(1, v, vis, 0, sum, val);
  cout << cnt << endl;
}
