#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 69;
long long int n, ans = 0;
std::vector<pair<long long int, long long int>> g[N];
long long int arr[N], sz[N], sum[N];
void dfs(long long int v, long long int p) {
  sz[v] = 1;
  for (auto u : g[v]) {
    if (u.first == p) continue;
    sum[u.first] = max(0LL, sum[v]) + u.second;
    dfs(u.first, v);
    sz[v] += sz[u.first];
  }
}
void dfs2(long long int v, long long int p) {
  for (auto u : g[v]) {
    if (u.first == p) continue;
    if (sum[u.first] > arr[u.first]) {
      ans += sz[u.first];
      continue;
    }
    dfs2(u.first, v);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; i++) cin >> arr[i];
  for (long long int i = 1; i < n; i++) {
    long long int p, c;
    cin >> p >> c;
    g[i + 1].push_back({p, c});
    g[p].push_back({i + 1, c});
  }
  dfs(1, 0);
  dfs2(1, 0);
  cout << ans << '\n';
  cerr << "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << "ms"
       << '\n';
}
