#include <bits/stdc++.h>
using namespace std;
long long a[100001], ans = 0, b[100001];
vector<vector<pair<long, int> > > tree;
void dfs(int src, int parent, long long dist) {
  for (int i = 0; i < tree[src].size(); i++) {
    if (tree[src][i].second != parent) {
      if (dist + tree[src][i].first > a[tree[src][i].second])
        ans += b[tree[src][i].second] + 1;
      else {
        if ((dist + tree[src][i].first) <= 0)
          dfs(tree[src][i].second, src, 0);
        else
          dfs(tree[src][i].second, src, dist + tree[src][i].first);
      }
    }
  }
}
int dfs1(int src, int parent) {
  long long number = 0;
  bool e = false;
  for (int i = 0; i < tree[src].size(); i++) {
    if (tree[src][i].second != parent) {
      e = true;
      number += dfs1(tree[src][i].second, src);
    }
  }
  b[src] = e ? number : 0;
  return b[src] + 1;
}
int main() {
  int n;
  long long p, c;
  cin >> n;
  tree.resize(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n - 1; i++) {
    cin >> p >> c;
    tree[p].push_back(make_pair(c, i + 1)),
        tree[i + 1].push_back(make_pair(c, p));
  }
  dfs1(1, -1);
  dfs(1, -1, 0);
  cout << ans << endl;
  return 0;
}
