#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const int inf = 0x7fffffff;
struct edge {
  int to, next, dis;
} e[maxn * 2];
int a[maxn], n, p, c, head[maxn], tot, ans;
void add(int u, int v, int d) {
  e[tot].to = v;
  e[tot].next = head[u];
  e[tot].dis = d;
  head[u] = tot++;
}
long long sum[maxn], minn[maxn];
void dfs(int u, int fa) {
  ans++;
  for (int i = head[u]; i != -1; i = e[i].next) {
    int v = e[i].to;
    if (v == fa) continue;
    sum[v] = sum[u] + e[i].dis;
    minn[v] = min(minn[u], sum[v]);
    if (sum[v] - minn[u] <= a[v]) {
      dfs(v, u);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), head[i] = -1, minn[i] = 0;
  for (int i = 2; i <= n; i++) {
    scanf("%d%d", &p, &c);
    add(i, p, c), add(p, i, c);
  }
  dfs(1, 0);
  cout << n - ans << endl;
  return 0;
}
