#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
vector<pair<int, int> > adj[N];
int a[N], sz[N];
int n, cnt;
int dfsSize(int v) {
  for (auto [u, w] : adj[v]) sz[v] += dfsSize(u);
  return ++sz[v];
}
void dfs(int v, long long mx) {
  if (mx > a[v]) {
    cnt += sz[v];
    return;
  }
  for (auto [u, w] : adj[v]) dfs(u, max(1LL * mx + w, 1LL * w));
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int p, w;
    cin >> p >> w;
    adj[--p].push_back({i, w});
  }
  dfsSize(0);
  dfs(0, -2e9);
  return cout << cnt, 0;
}
