#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10, M = 4e5 + 10;
int to[M], c[M], fi[N], ne[M], la[N], tot, dep[N], who[N], a[N], fa[N];
int n, m, x, y, ans, pt[N], p, sz[N], b[N];
void Add(int x, int y, int z) {
  to[++tot] = y;
  c[tot] = z;
  !fi[x] ? fi[x] = tot : ne[la[x]] = tot;
  la[x] = tot;
}
void Dfs(int x, int f, long long dis) {
  if (a[x] < dis) return;
  ans--;
  for (int i = fi[x]; i; i = ne[i]) {
    int v = to[i];
    if (v == f) continue;
    Dfs(v, x, max(0LL, dis + c[i]));
  }
}
int main(void) {
  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);
    Add(x, i + 1, y);
    Add(i + 1, x, y);
  }
  ans = n;
  Dfs(1, 0, 0);
  printf("%d\n", ans);
  return 0;
};
