#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100 * 100 * 10 * 3 + 10;
int b[MAXN], dp1[MAXN], dp2[MAXN];
vector<pair<int, int> > a[MAXN];
int ans = 0;
bool mark[MAXN];
void dfs(int v, int parent) {
  for (int i = 0; i < a[v].size(); i++) {
    if (a[v][i].first != parent) {
      dp1[a[v][i].first] = max(dp1[v] + a[v][i].second, a[v][i].second);
      if (dp1[a[v][i].first] > b[a[v][i].first]) mark[a[v][i].first] = true;
      if (mark[v] == true) mark[a[v][i].first] = true;
      dfs(a[v][i].first, v);
    }
  }
  if (mark[v] == true) ans++;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> b[i + 1];
  int x, y;
  for (int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    a[x].push_back(make_pair(i + 2, y));
    a[i + 2].push_back(make_pair(x, y));
  }
  dfs(1, -1);
  cout << ans << endl;
  return 0;
}
