#include <bits/stdc++.h>
using namespace std;
int *subtree_size, *visited, *a, *v;
vector<pair<int, long long> > *edges;
int toremove = 0;
int dfs1(int vertex) {
  v[vertex]++;
  subtree_size[vertex] = 1;
  for (auto adj : edges[vertex])
    if (not v[adj.first]) subtree_size[vertex] += dfs1(adj.first);
  return subtree_size[vertex];
}
int dfs(int vertex, long long height) {
  visited[vertex]++;
  height = max(height, (long long)0);
  for (auto adj : edges[vertex]) {
    if (not visited[adj.first]) {
      if (height + adj.second > a[adj.first]) {
        toremove += subtree_size[adj.first];
      } else {
        dfs(adj.first, height + adj.second);
      }
    }
  }
  return 0;
}
int main() {
  int n, p;
  cin >> n;
  long long c;
  subtree_size = new int[n + 1]();
  visited = new int[n + 1]();
  a = new int[n + 1]();
  edges = new vector<pair<int, long long> >[n + 1]();
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 2; i <= n; ++i) {
    cin >> p >> c;
    edges[p].push_back(make_pair(i, c));
    edges[i].push_back(make_pair(p, c));
  }
  v = new int[n + 1]();
  dfs1(1);
  delete[] v;
  dfs(1, 0);
  cout << toremove << endl;
  return 0;
}
