#include <bits/stdc++.h>
using namespace std;
long long a[100100];
vector<pair<int, int> > tree[100100];
bool bad[100100];
void dfs(int u, int p, long long val) {
  if (val > a[u]) {
    bad[u] = 1;
    return;
  }
  val = max(0LL, val);
  for (auto v : tree[u])
    if (v.first != p) dfs(v.first, u, val + v.second);
}
int count(int u, int p, bool ok) {
  int ans = 0;
  ok &= !bad[u];
  if (!ok) ans++;
  for (auto v : tree[u])
    if (v.first != p) ans += count(v.first, u, ok);
  return ans;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int p, x;
  for (int i = 1; i < n; i++) {
    cin >> p >> x;
    p--;
    tree[i].push_back({p, x});
    tree[p].push_back({i, x});
  }
  dfs(0, 0, 0);
  cout << count(0, 0, 1) << endl;
  return 0;
}
