#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<int, int> > vec[100001];
long long au[100001];
int func(int i, int x) {
  int opt = 1;
  for (int j = 0; j < vec[i].size(); j++) {
    if (vec[i][j].first != x) opt += func(vec[i][j].first, i);
  }
  return opt;
}
int solve(int i, long long c, int x, long long m) {
  if (c - m > au[i]) return func(i, x);
  int cnt = 0;
  m = min(m, c);
  for (int j = 0; j < vec[i].size(); j++) {
    if (vec[i][j].first == x) continue;
    cnt += solve(vec[i][j].first, c + vec[i][j].second, i, m);
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> au[i];
  for (int i = 1; i < n; i++) {
    int a, c;
    cin >> a >> c;
    vec[i + 1].push_back({a, c});
    vec[a].push_back({i + 1, c});
  }
  cout << solve(1, 0, -1, 0) << endl;
  return 0;
}
