#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 1;
int n;
vector<int> nxt[MAXN];
bool used[MAXN];
int c[MAXN], a[MAXN];
multiset<long long> lens;
void dfs(int v, long long len) {
  lens.insert(len);
  auto it = lens.begin();
  long long k = len + c[v] - *it;
  if (k > a[v]) {
    lens.erase(len);
    return;
  }
  used[v] = 1;
  for (int w : nxt[v]) {
    dfs(w, len + c[v]);
  }
  lens.erase(len);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d %d", &x, &c[i]);
    nxt[x].push_back(i);
  }
  for (int v : nxt[1]) dfs(v, 0);
  int ans = 0;
  for (int i = 2; i <= n; i++)
    if (!used[i]) ans++;
  printf("%d\n", ans);
  return 0;
}
