#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
vector<pair<int, int>> v[MAXN];
int sz[MAXN], ar[MAXN];
int ans = 0;
void findSize(int node, int p) {
  sz[node] = 1;
  for (int i = 0; i < v[node].size(); i++) {
    int to = v[node][i].first;
    if (to != p) {
      findSize(to, node);
      sz[node] += sz[to];
    }
  }
}
void dfs(int node, long long int cur, int p) {
  if (cur > ar[node]) {
    ans += sz[node];
    return;
  }
  for (int i = 0; i < v[node].size(); i++) {
    int to = v[node][i].first, w = v[node][i].second;
    if (to != p) {
      dfs(to, max(cur, 0ll) + w, node);
    }
  }
}
int main() {
#pragma warning(disable : 4996)
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &ar[i]);
  for (int i = 1; i < n; i++) {
    int a, w;
    scanf("%d%d", &a, &w);
    a--;
    v[a].push_back(make_pair(i, w));
    v[i].push_back(make_pair(a, w));
  }
  findSize(0, -1);
  dfs(0, 0, -1);
  printf("%d", ans);
  return 0;
}
