#include <bits/stdc++.h>
using namespace std;
int n, A[100005], ans, x, y;
vector<pair<int, int> > v[100005];
void dfs(int t, int r) {
  if (r > A[t]) return;
  ans++;
  for (int i = 0; i < (int)v[t].size(); i++) {
    dfs(v[t][i].first, max(r + v[t][i].second, 0));
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
  }
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(make_pair(i + 1, y));
  }
  dfs(1, 0);
  printf("%d", n - ans);
  return 0;
}
