#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<pair<int, int> > adj[maxn];
int n, maxd[maxn];
pair<int, int> dfs(int v, long long d) {
  int child = 0, clr = 0;
  for (auto u : adj[v]) {
    pair<int, int> p = dfs(u.first, max(1ll * 0, 1ll * d + u.second));
    child += p.first, clr += p.second;
  }
  if (maxd[v] < d)
    return make_pair(child + 1, child + 1);
  else
    return make_pair(child + 1, clr);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> maxd[i];
  for (int i = 1; i < n; i++) {
    int a, c;
    cin >> a >> c;
    a--;
    adj[a].push_back(make_pair(i, c));
  }
  cout << dfs(0, 0).second << endl;
  return 0;
}
