#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct edge {
  int ver, val, next;
} f[N * 2];
int n, h[N], t, v[N], s[N], a[N], ans;
long long d[N];
void add(int x, int y, int z) {
  f[++t].next = h[x];
  h[x] = t;
  f[t].ver = y;
  f[t].val = z;
}
void dfs(int x) {
  v[x] = s[x] = 1;
  for (int i = h[x]; i; i = f[i].next) {
    int y = f[i].ver;
    if (v[y]) continue;
    d[y] = max(d[x] + f[i].val, (long long)f[i].val);
    dfs(y);
    s[x] += s[y];
  }
}
void work(int x) {
  v[x] = 1;
  if (d[x] > a[x]) {
    ans += s[x];
    return;
  }
  for (int i = h[x]; i; i = f[i].next) {
    int y = f[i].ver;
    if (v[y]) continue;
    work(y);
  }
}
int main() {
  int x, y;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 2; i <= n; ++i) {
    scanf("%d%d", &x, &y);
    add(i, x, y), add(x, i, y);
  }
  dfs(1);
  memset(v, 0, sizeof(v));
  work(1);
  printf("%d", ans);
  return 0;
}
