#include <bits/stdc++.h>
using namespace std;
const int infint = INT_MAX;
const long long infll = LLONG_MAX;
const int MAX = 1e5 + 100;
int n;
vector<pair<int, long long> > adj[MAX];
int cnt[MAX], col[MAX];
int getcnt(int v, int par) {
  int res = 1;
  for (auto u : adj[v]) {
    if (u.first == par) continue;
    res += getcnt(u.first, v);
  }
  return cnt[v] = res;
}
int ans = 0;
int dfs(int v, int par, long long dist) {
  if (dist > col[v]) {
    return cnt[v];
  }
  int res = 0;
  for (auto u : adj[v]) {
    if (u.first == par) continue;
    res += dfs(u.first, v, max(u.second, dist + u.second));
  }
  return res;
}
int main() {
  memset(cnt, 0, sizeof(cnt));
  cin >> n;
  for (int i = 1; i < n + 1; i++) cin >> col[i];
  for (int i = 2; i < n + 1; i++) {
    int p;
    long long sz;
    cin >> p >> sz;
    adj[i].push_back({p, sz});
    adj[p].push_back({i, sz});
  }
  getcnt(1, 0);
  cout << dfs(1, 0, 0);
  return 0;
}
