#include <bits/stdc++.h>
using namespace std;
bool pd[100050];
int go[200050], nex[200050], head[200050], qq[200040], a[100020], tot;
void add(int p, int q, int z) {
  go[++tot] = q;
  nex[tot] = head[p];
  head[p] = tot;
  qq[tot] = z;
}
void dfs(int u, int f, int ttt) {
  if (ttt > a[u]) {
    pd[u] = true;
    return;
  }
  int tem;
  for (int i = head[u]; i; i = nex[i]) {
    tem = go[i];
    if (tem == f) continue;
    dfs(tem, u, max(0, ttt + qq[i]));
  }
}
int dfs2(int u, int f) {
  int tt = 1, tem;
  for (int i = head[u]; i; i = nex[i]) {
    tem = go[i];
    if (tem == f || pd[tem]) continue;
    tt += dfs2(tem, u);
  }
  return tt;
}
int main() {
  int n, x, y;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    cin >> x >> y;
    add(x, i, y);
  }
  dfs(1, 0, 0);
  cout << n - dfs2(1, 0) << endl;
}
