#include <bits/stdc++.h>
using namespace std;
long long frev(long long x, long long y) { return x > y; }
long long findset(long long a, long long ds[], long long rank[]) {
  if (a == ds[a]) return a;
  ds[a] = findset(ds[a], ds, rank);
  return ds[a];
}
long long dsu(long long a, long long b, long long ds[], long long rank[]) {
  long long repa = findset(a, ds, rank);
  long long repb = findset(b, ds, rank);
  if (rank[repa] == rank[repb]) {
    rank[repb]++;
    ds[repa] = repb;
  }
  if (rank[repa] > rank[repb]) {
    ds[repb] = repa;
  } else {
    ds[repa] = repb;
  }
  return 1;
}
long long gcd(long long a, long long b) {
  if (a > b) {
    long long t = a;
    a = b;
    b = t;
  }
  if (b % a == 0)
    return a;
  else
    return gcd(a, b % a);
}
int dfs(long long r, vector<pair<long long, long long>> g[], long long dist[],
        long long mind[], long long vis[], long long siz[]) {
  vis[r] = 1;
  siz[r] = 1;
  for (auto lp : g[r]) {
    long long l = lp.first;
    long long w = lp.second;
    if (!vis[l]) {
      dist[l] = dist[r] + w;
      mind[l] = min(mind[r], dist[l]);
      siz[r] += dfs(l, g, dist, mind, vis, siz);
    }
  }
  return siz[r];
}
int main() {
  long long n;
  cin >> n;
  long long a[n + 1];
  for (long long i = 1; i <= n; i++) cin >> a[i];
  vector<pair<long long, long long>> gr[n + 1];
  long long dist[n + 1];
  long long mind[n + 1];
  for (long long i = 1; i <= n - 1; i++) {
    long long p, edge;
    cin >> p >> edge;
    gr[p].push_back({i + 1, edge});
  }
  dist[1] = 0;
  mind[1] = 0;
  long long siz[n + 1];
  long long vis[n + 1];
  for (long long i = 1; i <= n; i++) vis[i] = 0;
  dfs(1, gr, dist, mind, vis, siz);
  for (long long i = 1; i <= n; i++) vis[i] = 0;
  queue<long long> q;
  q.push(1);
  vis[1] = 1;
  long long ans = 0;
  while (!q.empty()) {
    long long fr = q.front();
    q.pop();
    if (dist[fr] - mind[fr] > a[fr]) {
      ans += siz[fr];
    } else {
      for (auto lp : gr[fr]) {
        long long l = lp.first;
        long long w = lp.second;
        if (!vis[l]) {
          vis[l] = 1;
          q.push(l);
        }
      }
    }
  }
  cout << ans;
}
