#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp[100010];
vector<long long> a[100010];
long long mx[100010], b[100010], num[100010];
queue<long long> q;
long long dfs(long long x, long long par) {
  if (x == 1) {
    mx[x] = 0;
  } else {
    mx[x] = max(0ll, mp[x][par] + mx[par]);
  }
  int cnt = 1;
  for (long long i = 0; i < a[x].size(); ++i) {
    if (a[x][i] == par) {
      continue;
    }
    cnt += dfs(a[x][i], x);
  }
  num[x] = cnt;
  return cnt;
}
long long ans = 0;
void dfs2(int x, int par) {
  if (mx[x] > b[x]) {
    ans += num[x];
    return;
  }
  for (long long i = 0; i < a[x].size(); ++i) {
    if (a[x][i] == par) {
      continue;
    }
    dfs2(a[x][i], x);
  }
}
long long child[100010] = {0};
int main() {
  long long n, x, y, tp;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> b[i];
  }
  for (long long i = 1; i <= n - 1; ++i) {
    cin >> x >> y;
    a[i + 1].push_back(x);
    a[x].push_back(i + 1);
    mp[i + 1][x] = y;
    mp[x][i + 1] = y;
    ++child[i + 1];
    ++child[x];
  }
  dfs(1, 1);
  dfs2(1, 1);
  cout << ans << endl;
  return 0;
}
