#include <bits/stdc++.h>
using namespace std;
long long a[100005], dist[100005], sad[100005], subt[100005], ans = 0LL;
vector<pair<long long, long long> > adj[100005];
void dfs(long long node, long long par, long long min_vertex) {
  if (par != -1) sad[node] = (a[node] < dist[node] - dist[min_vertex]);
  min_vertex = (dist[node] < dist[min_vertex]) ? node : min_vertex;
  for (auto i : adj[node])
    if (par != i.first) {
      dist[i.first] += (dist[node] + i.second);
      dfs(i.first, node, min_vertex);
      subt[node] += subt[i.first];
    }
  subt[node]++;
}
void dfs1(long long node, long long par) {
  if (sad[node]) {
    ans += subt[node];
    return;
  }
  for (auto i : adj[node])
    if (i.first != par) dfs1(i.first, node);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long n, i, j, k;
    cin >> n;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 1; i <= n - 1; i++) {
      long long x, wt;
      cin >> x >> wt;
      adj[i + 1].push_back(make_pair(x, wt));
      adj[x].push_back(make_pair(i + 1, wt));
    }
    dfs(1, -1, 1);
    dfs1(1, -1);
    cout << ans;
  }
  return 0;
}
