#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, resp = 0;
int val[MAXN], sub[MAXN];
vector<int> v[MAXN];
vector<int> p[MAXN];
void init(int cur) {
  sub[cur] = 1;
  for (int i = 0; i < v[cur].size(); i++) {
    init(v[cur][i]);
    sub[cur] += sub[v[cur][i]];
  }
}
void dfs(int cur, int depth) {
  if (depth < 0) depth = 0;
  if (depth > val[cur])
    resp += sub[cur];
  else {
    for (int i = 0; i < v[cur].size(); i++) dfs(v[cur][i], depth + p[cur][i]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 2, a, b; i <= n; i++) {
    scanf("%d %d", &a, &b);
    v[a].push_back(i);
    p[a].push_back(b);
  }
  init(1);
  dfs(1, 0);
  printf("%d\n", resp);
}
