#include <bits/stdc++.h>
using namespace std;
long long ans;
void dfs(int x, vector<vector<pair<int, int>>>& g, vector<int>& mark,
         vector<int>& s) {
  mark[x] = 1;
  for (auto to : g[x]) {
    int v = to.first;
    if (!mark[v]) {
      dfs(v, g, mark, s);
      s[x] += s[v];
    }
  }
}
void dfs1(int x, vector<vector<pair<int, int>>>& g, vector<int>& mark,
          vector<int>& s, int d, vector<int>& a) {
  mark[x] = 1;
  if (a[x] < d)
    ans += s[x];
  else {
    for (auto to : g[x]) {
      int v = to.first;
      int w = to.second;
      if (!mark[v]) {
        dfs1(v, g, mark, s, max(0, d + w), a);
      }
    }
  }
}
int main() {
  ans = 0;
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<vector<pair<int, int>>> g(n);
  int v, w;
  for (int i = 0; i < n - 1; i++) {
    cin >> v >> w;
    v--;
    g[v].push_back({i + 1, w});
  }
  vector<int> s(n), mark(n);
  mark.assign(n, 0);
  s.assign(n, 1);
  dfs(0, g, mark, s);
  mark.assign(n, 0);
  dfs1(0, g, mark, s, 0, a);
  cout << ans << "\n";
  return 0;
}
