#include <bits/stdc++.h>
using namespace std;
map<pair<long long int, long long int>, long long int> edge;
long long int a[100005];
vector<long long int> graph[100005];
long long int ans;
long long int count_node(long long int src, long long int par) {
  long long int count = 1;
  for (long long int i = 0; i < graph[src].size(); i++) {
    if (graph[src][i] != par) {
      count += count_node(graph[src][i], src);
    }
  }
  return count;
}
void dfs(long long int src, long long int par, long long int mini,
         long long int dist) {
  dist += edge[{par, src}];
  mini = min(mini, dist);
  if (dist - mini > a[src]) {
    ans += count_node(src, par);
    return;
  }
  for (long long int i = 0; i < graph[src].size(); i++) {
    if (graph[src][i] != par) {
      dfs(graph[src][i], src, mini, dist);
    }
  }
}
int main() {
  ios_base::sync_with_stdio;
  cin.tie(NULL);
  long long int i, j, n, t, k, m;
  t = 1;
  while (t--) {
    cin >> n;
    for (long long int i = 1; i < n + 1; i++) {
      cin >> a[i];
    }
    for (i = 1; i <= n - 1; i++) {
      long long int u;
      cin >> u;
      long long int v = i + 1;
      graph[u].push_back(v);
      graph[v].push_back(u);
      long long int num;
      cin >> num;
      edge[{u, v}] = num;
      edge[{v, u}] = num;
    }
    ans = 0;
    dfs(1, -1, 1e10, 0);
    cout << ans;
  }
}
