#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e+9;
const long long N = 1e+5;
long long a[N], sz[N];
vector<pair<long long, long long>> gr[N];
long long dfs0(long long v, long long p = -1) {
  long long res = 1;
  for (auto x : gr[v])
    if (x.first != p) res += dfs0(x.first, v);
  return sz[v] = res;
}
long long dfs(long long v, long long p = -1, long long m = 0, long long s = 0) {
  long long res = 0;
  for (auto x : gr[v]) {
    long long u = x.first, e = x.second;
    if (u != p)
      if (s + e - a[u] > m)
        res += sz[u];
      else
        res += dfs(u, v, min(m, s + e), s + e);
  }
  return res;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 1; i < n; i++) {
    long long p, c;
    cin >> p >> c;
    p--;
    gr[i].push_back({p, c});
    gr[p].push_back({i, c});
  }
  dfs0(0);
  cout << dfs(0);
}
