#include <bits/stdc++.h>
using namespace std;
double pi = 3.141592653589793238462;
string numkey = "0123456789";
string uni = "abcdefghijklmnopqrstuvwxyz";
long long int dx[4] = {0, 0, 1, -1};
long long int dy[4] = {1, -1, 0, 0};
long long int INF = (1LL << 62);
long long int ew[100000 + 10];
long long int arr[100000 + 10], ans = 0;
vector<long long int> g[100000 + 10];
void dfs(long long int v, long long int sum) {
  if (sum > arr[v]) return;
  if (sum < 0) sum = 0;
  ans++;
  for (auto i : g[v]) dfs(i, sum + ew[i]);
}
signed main() {
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (long long int i = 2; i <= n; i++) {
    long long int p;
    cin >> p >> ew[i];
    g[p].push_back(i);
  }
  dfs(1, 0);
  cout << n - ans;
  return 0;
}
