#include <bits/stdc++.h>
using namespace std;
struct info {
  int val, lev, sum, cnt, chk;
} lar[100001];
struct info2 {
  int lev, val;
} arr[1000001];
vector<int> mat[100001], cost[100001];
int st, stk[100000], top, len, blen, vld;
void bfs(int x, int lvl) {
  int v = 0;
  lar[x].sum = 0;
  lar[x].lev = lvl;
  lar[x].cnt = 1;
  lar[x].chk = 1;
  while (top != -1) {
    for (int i = 1; i <= mat[x][0]; i++) {
      if (lar[mat[x][i]].cnt == 0) {
        stk[top] = mat[x][i];
        top++;
        lar[mat[x][i]].sum = max(0, v + cost[x][i]);
        lar[mat[x][i]].cnt++;
        if (lar[x].chk == 0 || (lar[mat[x][i]].sum > lar[mat[x][i]].val)) {
          lar[mat[x][i]].chk = 0;
          len++;
        } else
          lar[mat[x][i]].chk = 1;
      }
    }
    top--;
    if (top == -1) break;
    x = stk[top];
    lvl = lar[x].lev;
    v = lar[x].sum;
  }
}
int main() {
  ios::sync_with_stdio(false);
  int i, j, x, y, n, m, z, a, b, c;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> lar[i].val;
  }
  for (i = 1; i <= n; i++) {
    mat[i].clear();
    cost[i].clear();
    mat[i].push_back(0);
    cost[i].push_back(0);
  }
  for (i = 1; i < n; i++) {
    a = i + 1;
    cin >> b >> c;
    mat[a][0] = mat[a][0] + 1;
    mat[b][0] = mat[b][0] + 1;
    mat[a].push_back(b);
    mat[b].push_back(a);
    cost[a].push_back(c);
    cost[b].push_back(c);
  }
  top = 0;
  stk[top] = 1;
  bfs(1, 1);
  cout << len;
  return 0;
}
