#include <bits/stdc++.h>
using namespace std;
int n, a[100005], pref[100005], ans, par[100005];
bool used[100005];
vector<pair<int, int> > g[100005];
void dfs(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first;
    if (!used[to]) {
      ans++;
      dfs(to);
    }
  }
}
void counter(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i].first, weight = g[v][i].second;
    if (!used[to]) {
      if (pref[v] >= 0) {
        pref[to] = pref[v] + weight;
      } else
        pref[to] = weight;
      if (pref[to] > a[to]) {
        ans++;
        dfs(to);
      }
      counter(to);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i <= n; i++) {
    int to, x;
    cin >> to >> x;
    g[i].push_back(make_pair(to, x));
    g[to].push_back(make_pair(i, x));
  }
  counter(1);
  cout << ans;
}
