#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v[100010];
long long a[100010];
long long b[100010];
int par[100010];
long long cnt = 0;
void dfs(int s, int dad, long long sm) {
  cnt++;
  int sz = v[s].size();
  for (int i = 0; i < sz; i++) {
    pair<int, int> x = v[s][i];
    if (x.first != dad) {
      par[x.first] = s;
      long long smNow = sm + x.second;
      b[x.first] = smNow;
      int j = par[x.first];
      int flag = 0;
      int ab = 0;
      while (j != -1) {
        if (ab++ == 5) break;
        if ((b[x.first] - b[j]) > a[x.first]) {
          flag = 1;
          break;
        }
        j = par[j];
      }
      if (flag == 0) {
        dfs(x.first, s, smNow);
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[i] = 0;
  }
  memset(par, -1, sizeof(par));
  for (int i = 0; i <= n; i++) v[i].clear();
  cnt = 0;
  for (int i = 1; i <= n - 1; i++) {
    int u, w;
    cin >> u >> w;
    v[i + 1].push_back(make_pair(u, w));
    v[u].push_back(make_pair(i + 1, w));
  }
  par[1] = -1;
  dfs(1, 0, 0);
  cout << n - cnt << endl;
  return 0;
}
