#include <bits/stdc++.h>
using namespace std;
int a[100500];
vector<pair<int, int> > g[100500];
void addEdge(int x, int y, int w) {
  x--, y--;
  g[x].push_back(make_pair(y, w));
  g[y].push_back(make_pair(x, w));
}
bool used[100500];
bool used2[100500];
bool bad[100500];
void dfs(int v, int sum) {
  sum = max(sum, 0);
  used[v] = true;
  if (sum > a[v]) {
    bad[v] = true;
    return;
  }
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i].first;
    if (used[u]) continue;
    int w = g[v][i].second;
    dfs(u, sum + w);
  }
}
int dfs2(int v) {
  int res = 1;
  used2[v] = true;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i].first;
    if (used2[u]) continue;
    if (bad[u]) continue;
    res += dfs2(u);
  }
  return res;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n - 1; i++) {
    int w, j;
    scanf("%d%d", &j, &w);
    addEdge(i + 1, j, w);
  }
  dfs(0, 0);
  int ans = n - dfs2(0);
  printf("%d\n", ans);
  return 0;
}
