#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > adj[1000005];
long long a[1000005];
int visited = 0;
void dfs(int u, int w) {
  if (w > a[u]) {
    return;
  }
  visited++;
  for (int i = 0; i < adj[u].size(); i++) {
    int v = adj[u][i].first;
    int w1 = adj[u][i].second;
    dfs(v, max(0, w1 + w));
  }
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n - 1; i++) {
    long long x, weight;
    cin >> x >> weight;
    adj[x].push_back(make_pair(i + 1, weight));
  }
  dfs(1, 0);
  cout << n - visited << endl;
  return 0;
}
