#include <bits/stdc++.h>
using namespace std;
const int D = 1e5 + 5;
int ect, head[D], val[D], dis[D], cnt, n;
struct edge {
  int v, nxt, w;
} e[D];
void adde(int u, int v, int w) {
  e[ect].v = v;
  e[ect].w = w;
  e[ect].nxt = head[u];
  head[u] = ect++;
}
void dfs(int u) {
  if (dis[u] > val[u]) return;
  cnt++;
  for (int i = head[u]; ~i; i = e[i].nxt) {
    int v = e[i].v;
    dis[v] = dis[u] > 0 ? dis[u] + e[i].w : e[i].w;
    dfs(v);
  }
}
int main() {
  scanf("%d", &n);
  memset(head, -1, sizeof(head));
  int u, w;
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 2; i <= n; i++) {
    scanf("%d%d", &u, &w);
    adde(u, i, w);
  }
  dfs(1);
  printf("%d", n - cnt);
}
