#include <bits/stdc++.h>
using namespace std;
long long n;
long long res = 0;
vector<long long> nodes;
vector<vector<long long> > adj;
map<pair<long long, long long>, long long> cost;
void dfs(long long child, long long parent, long long sum) {
  if (nodes[child] < sum) return;
  res++;
  for (long long i = 0; i < adj[child].size(); i++) {
    if (adj[child][i] == parent) continue;
    long long cost2 = cost[make_pair(adj[child][i], child)];
    long long sum2 = sum + cost2;
    long long zero = 0;
    dfs(adj[child][i], child, max(sum2, zero));
  }
}
int main() {
  cin >> n;
  nodes = vector<long long>(n + 1);
  for (long long i = 0; i < n; i++) cin >> nodes[i + 1];
  adj = vector<vector<long long> >(n + 1);
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    adj[a].push_back(i + 2);
    adj[i + 2].push_back(a);
    cost[make_pair(a, i + 2)] = b;
    cost[make_pair(i + 2, a)] = b;
  }
  dfs(1, 0, 0);
  cout << n - res;
  return 0;
}
