#include <bits/stdc++.h>
using namespace std;
vector<int> edge;
int n;
vector<pair<int, int> > v[100001];
bool vis[1000001] = {0};
int first = 0;
int c = 0;
void dfs(int x, int sum, bool yes) {
  if (sum > edge[x]) {
    yes = 1;
  }
  if (yes == 1) {
    c++;
  }
  vis[x] = 1;
  for (int i = 0; i < v[x].size(); i++) {
    if (!vis[v[x][i].first]) {
      if (sum + v[x][i].second >= 0) {
        dfs(v[x][i].first, sum + v[x][i].second, yes);
      } else {
        dfs(v[x][i].first, 0, yes);
      }
    }
  }
}
int main() {
  cin >> n;
  edge.push_back(0);
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    edge.push_back(a);
  }
  for (int i = 2; i <= n; i++) {
    int a, p;
    cin >> a >> p;
    v[a].push_back(make_pair(i, p));
    v[i].push_back(make_pair(a, p));
  }
  dfs(1, 0, 0);
  cout << c << endl;
  return 0;
}
