#include <bits/stdc++.h>
using namespace std;
long long n, a[100100], d[100100], cnt[100100], bad[100100];
vector<pair<long long, long long>> g[100100];
long long init(int v, int p) {
  for (auto u : g[v]) {
    if (u.first == p) continue;
    d[u.first] = d[v] + u.second;
    cnt[v] += init(u.first, v);
  }
  return cnt[v] += 1;
}
void dfs(int v, int p, long long dist, multiset<pair<long long, int>> &dst) {
  if (dist - dst.begin()->first > a[v]) {
    bad[v] = 1;
    return;
  }
  for (auto u : g[v]) {
    if (u.first == p) continue;
    dst.insert(make_pair(dist, u.first));
    dfs(u.first, v, dist + u.second, dst);
    dst.erase(make_pair(dist, u.first));
  }
}
long long res;
void calc(int v, int p) {
  if (bad[v]) {
    res += cnt[v];
    return;
  }
  for (auto u : g[v]) {
    if (u.first == p) continue;
    calc(u.first, v);
  }
}
int main() {
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    int p, c;
    scanf("%d%d", &p, &c);
    g[i + 1].push_back({p, c});
    g[p].push_back({i + 1, c});
  }
  init(1, 0);
  multiset<pair<long long, int>> dst;
  dst.insert(make_pair(0, 1));
  dfs(1, 0, 0, dst);
  calc(1, 0);
  printf("%I64d\n", res);
}
