#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6;
vector<pair<long long int, long long int> > vec[MAX];
int N;
int ans;
long long int arr[MAX];
void dfs(int node, int par, long long int dis) {
  if (dis > arr[node]) return;
  ans++;
  for (int A = 0; A < vec[node].size(); A++)
    if (vec[node][A].second != par)
      dfs(vec[node][A].second, node,
          max(dis + vec[node][A].first, vec[node][A].first));
}
int main() {
  cin >> N;
  for (int A = 1; A <= N; A++) cin >> arr[A];
  for (int A = 1; A < N; A++) {
    long long int X, Y;
    cin >> X >> Y;
    vec[X].push_back(make_pair(Y, A + 1));
    vec[A + 1].push_back(make_pair(Y, X));
  }
  dfs(1, 0, 0);
  cout << N - ans;
  return 0;
}
