#include <bits/stdc++.h>
using namespace std;
long long a[100100], b[100100], c[100100], p[100100], s[100100];
vector<long long> al[100100];
long long dfs(int v = 0) {
  if (v == 0)
    b[v] = 0;
  else if (b[p[v]] < 0)
    b[v] = c[v];
  else
    b[v] = c[v] + b[p[v]];
  for (int i = 0; i < al[v].size(); i++) s[v] += dfs(al[v][i]);
  return ++s[v];
}
long long dfs2(int v = 0) {
  long long ok = 0;
  if (b[v] > a[v])
    return s[v];
  else
    for (int i = 0; i < al[v].size(); i++) ok += dfs2(al[v][i]);
  return ok;
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    cin >> p[i] >> c[i];
    al[--p[i]].push_back(i);
  }
  dfs();
  cout << dfs2() << endl;
  return 0;
}
