#include <cstdio>#include <iostream>#include <cstring>usingnamespacestd;
int vd[100010];
struct Edge{
int next, to, v;
}edge[100010];
int head[100010], num = 0;
void add_edge(int a, int b, int c)
{
edge[++ num].to = b, edge[num].v = c;
edge[num].next = head[a], head[a] = num;
}
int sz[100010];
void dfs1(int x, int f){
sz[x] = 1;
for (int i = head[x]; i != -1; i = edge[i].next)
if (edge[i].to != f) {
dfs1(edge[i].to, x);
sz[x] += sz[edge[i].to];
}
}
int ans = 0;
void work(int x, int f, int k)
{
if (k > vd[x]){
ans += sz[x];
return;
}
for (int i = head[x]; i != -1; i = edge[i].next)
if (edge[i].to != f)
work(edge[i].to, x, max(k + edge[i].v, edge[i].v));
}
int main()
{
int n;
scanf("%d", &n);
memset(head, -1, sizeof(head));
for (int i = 1; i <= n; i ++) scanf("%d", &vd[i]);
int a, b;
for (int i = 2; i <= n; i ++){
scanf("%d %d", &a, &b);
add_edge(a, i, b);
}
dfs1(1, 0); work(1, 0, 0);
printf("%d\n", ans);
return0;
}