#include <bits/stdc++.h>
using namespace std;
int a[100000];
vector<vector<pair<int, int> > > dp(100000);
bool b[100000];
int dfs(int top, long long value) {
  value = max(value, 0ll);
  int ans = 0;
  b[top] = 1;
  for (int i = 0; i < dp[top].size(); i++) {
    int q = dp[top][i].first, w = dp[top][i].second;
    if (b[q]) continue;
    if (value + w <= a[q]) ans += 1 + dfs(q, value + w);
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    int A, B;
    scanf("%d%d", &A, &B);
    A--;
    dp[i].push_back({A, B});
    dp[A].push_back({i, B});
  }
  cout << n - 1 - dfs(0, 0);
  return 0;
}
