#include <bits/stdc++.h>
using namespace std;
long long int n, ans = 0;
long long int arr[100000 + 1], sz[1000005];
vector<vector<pair<int, int>>> graph;
void dfs1(long long int src, long long int par) {
  int cnt = 1;
  for (auto it : graph[src]) {
    if (par != it.first) {
      dfs1(it.first, src);
      cnt += sz[it.first];
    }
  }
  sz[src] = cnt;
}
void dfs(long long int src, long long int par, long long int sm) {
  if (sm > arr[src]) {
    ans += sz[src];
    return;
  }
  for (auto it : graph[src]) {
    if (it.first != par) {
      dfs(it.first, src, it.second + sm <= 0 ? 0 : it.second + sm);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    cin >> n;
    for (long long int i = 1; i <= n; i++) cin >> arr[i];
    graph.assign(n + 1, vector<pair<int, int>>());
    for (long long int i = 1; i < n; i++) {
      long long int a, b;
      cin >> a >> b;
      graph[i + 1].push_back({a, b});
      graph[a].push_back({i + 1, b});
    }
    ans = 0;
    dfs1(1, -1);
    dfs(1, -1, 0);
    cout << ans;
  }
  return 0;
}
