#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int vis[maxn];
vector<int> e[maxn];
vector<int> w[maxn];
int a[maxn];
int ans;
void add_edge(int u, int v, int ww) {
  e[u].push_back(v);
  e[v].push_back(u);
  w[u].push_back(ww);
  w[v].push_back(ww);
}
void dfs(int num, int l, int c) {
  if (l > a[num] && c != 1) {
    c = 1;
  }
  if (c == 1) {
    ans++;
  }
  vis[num] = 1;
  int cc = e[num].size();
  for (int i = 0; i < cc; i++) {
    if (!vis[e[num][i]]) {
      if (l < 0) l = 0;
      vis[e[num][i]] = 1;
      dfs(e[num][i], l + w[num][i], c);
    }
  }
}
int main() {
  memset(vis, 0, sizeof(vis));
  int n;
  scanf("%d", &n);
  ans = 0;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 2; i <= n; i++) {
    int u = i, v, ww;
    scanf("%d%d", &v, &ww);
    add_edge(u, v, ww);
  }
  ans = 0;
  dfs(1, 0, 0);
  printf("%d\n", ans);
}
