#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
vector<pair<int, long long>> g[N];
int sub[N];
long long a[N];
int ans = 0;
void subtree(int v, int pv) {
  sub[v] = 1;
  for (auto j : g[v]) {
    if (j.first != pv) {
      subtree(j.first, v);
      sub[v] += sub[j.first];
    }
  }
}
void dfs(int v, int pv, long long sum) {
  if (sum > a[v]) {
    ans += sub[v];
    return;
  }
  for (auto j : g[v]) {
    if (j.first != pv) {
      dfs(j.first, v, max(sum + j.second, j.second));
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 2; i <= n; i++) {
    int p, c;
    cin >> p >> c;
    g[p].push_back({i, c});
    g[i].push_back({p, c});
  }
  subtree(1, -1);
  dfs(1, -1, 0LL);
  cout << ans;
}
