#include <bits/stdc++.h>
using namespace std;
template <typename T>
class heap : public priority_queue<T, vector<T>, greater<T> > {};
vector<vector<pair<int, int> > > e;
vector<int> val;
int size(int x, int p) {
  int ans = 1;
  for (auto y : e[x]) {
    if (y.first == p) continue;
    ans += size(y.first, x);
  }
  return ans;
}
int solve(int x, int p, long long prefix, long long m) {
  if (prefix - val[x] > m) return size(x, p);
  int ans = 0;
  for (auto y : e[x]) {
    if (y.first == p) continue;
    ans += solve(y.first, x, prefix + y.second, min(m, prefix + y.second));
  }
  return ans;
}
int main(void) {
  int n;
  scanf("%d", &n);
  val.resize(n);
  e.resize(n);
  for (int i = 0; i < n; ++i) scanf("%d", &val[i]);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a;
    e[i + 1].push_back(make_pair(a, b));
    e[a].push_back(make_pair(i + 1, b));
  }
  printf("%d\n", solve(0, -1, 0, 0));
}
