#include <bits/stdc++.h>
using namespace std;
int N;
int A[100005];
int V, D;
map<pair<int, int>, int> Dist;
vector<int> Graph[100005];
int Ans = 0;
void DFS(int Q, long long Val) {
  if (Val > A[Q]) return;
  Val = max(Val, 0LL);
  Ans++;
  for (int i = 0; i < Graph[Q].size(); i++)
    DFS(Graph[Q][i], Val + Dist[{Q, Graph[Q][i]}]);
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i + 1];
  for (int i = 1; i < N; i++) {
    cin >> V >> D;
    Dist[{V, i + 1}] = D;
    Graph[V].push_back(i + 1);
  }
  DFS(1, 0);
  cout << (N - Ans) << endl;
}
