#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > gr[100500];
int num[100500];
int clr[100500];
bool del[100500];
int res;
void dfs(int v, int mode, int nakop) {
  clr[v] = 1;
  if (mode == 1) {
    del[v] = 1;
    res++;
  }
  for (int i = 0; i < gr[v].size(); i++) {
    if (mode == 0) {
      int x = gr[v][i].first;
      if (clr[x] == 1) {
        continue;
      }
      if (max(0, nakop + gr[v][i].second) > num[x]) {
        dfs(x, 1, -1);
        continue;
      }
      dfs(x, 0, max(0, nakop + gr[v][i].second));
    } else {
      int x = gr[v][i].first;
      if (clr[x] == 1) {
        continue;
      }
      dfs(x, 1, -1);
    }
  }
}
int main() {
  res = 0;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
  }
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    gr[i + 1].push_back(make_pair(a, b));
    gr[a].push_back(make_pair(i + 1, b));
  }
  dfs(1, 0, 0);
  cout << res;
  return 0;
}
