#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const long long mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);
int n, a[N], p[N], c[N];
vector<vector<int> > v(N);
bool vis[N], good[N];
void dfs(int index, long long sum) {
  int len = v[index].size();
  for (int i = 0; i < len; i++) {
    int k = v[index][i];
    if (vis[k]) continue;
    vis[k] = true;
    int val = 0;
    if (p[index - 1] == k)
      val = c[index - 1];
    else if (p[k - 1] == index)
      val = c[k - 1];
    long long w = sum;
    if (w < 0) w = 0;
    if (w + val <= a[k]) {
      good[k] = true;
      dfs(k, w + val);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &p[i], &c[i]);
    v[i + 1].push_back(p[i]);
    v[p[i]].push_back(i + 1);
  }
  memset(vis, false, sizeof(vis));
  memset(good, false, sizeof(good));
  good[1] = true;
  vis[1] = true;
  dfs(1, 0);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (good[i]) ans++;
  printf("%d\n", n - ans);
  return 0;
}
