#include <bits/stdc++.h>
int first[100002], a[100002];
int next[200004], to[200004], q[200004];
int num;
void dfs(int u, long long sum, int fa) {
  int v, e;
  num++;
  e = first[u];
  while (e) {
    v = to[e];
    if (v != fa && q[e] + sum <= a[v]) {
      if (q[e] + sum < 0)
        dfs(v, 0, u);
      else
        dfs(v, sum + q[e], u);
    }
    e = next[e];
  }
}
int main() {
  int n, i, f, t, v, e;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (e = 1, f = 2; f <= n; e++, f++) {
    scanf("%d%d", &t, &v);
    next[e] = first[f];
    first[f] = e;
    to[e] = t;
    q[e] = v;
    next[e + n] = first[t];
    first[t] = e + n;
    to[e + n] = f;
    q[e + n] = v;
  }
  dfs(1, 0, 0);
  printf("%d\n", n - num);
  return 0;
}
