#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * f;
}
const int maxn = 1e5 + 10;
int n, tot, head[maxn], d[maxn], a[maxn], ans, sz[maxn];
struct data {
  int to, next, w;
} edge[maxn];
void calc(int x) {
  sz[x] = 1;
  for (int i = head[x]; i; i = edge[i].next) {
    int y = edge[i].to;
    calc(y);
    sz[x] += sz[y];
  }
}
void dfs(int x) {
  if (d[x] > a[x]) {
    ans += sz[x];
    return;
  }
  for (int i = head[x]; i; i = edge[i].next) {
    int y = edge[i].to;
    d[y] = d[x] + edge[i].w;
    if (d[y] < 0) d[y] = 0;
    dfs(y);
  }
}
inline void make(int u, int v, int w) {
  edge[++tot] = (data){v, head[u], w};
  head[u] = tot;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 2; i <= n; i++) {
    int x = read(), y = read();
    make(x, i, y);
  }
  calc(1);
  dfs(1);
  cout << ans;
  return 0;
}
