#include <bits/stdc++.h>
const int MAX_N = (int)3e5 + 123;
const double eps = 1e-6;
const int inf = (int)1e9 + 123;
using namespace std;
int n;
int a[MAX_N];
vector<pair<int, int> > g[MAX_N];
int sz[MAX_N];
long long int d[MAX_N];
void dfs(int v) {
  sz[v] = 1;
  for (auto to : g[v]) {
    d[to.first] = max(d[to.first], d[v] + to.second);
    dfs(to.first);
    sz[v] += sz[to.first];
  }
}
int ans = 0;
void calc(int v) {
  if (d[v] > a[v]) {
    ans += sz[v];
    return;
  }
  for (auto to : g[v]) calc(to.first);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 2, p, c; i <= n; i++) {
    scanf("%d%d", &p, &c);
    g[p].push_back(make_pair(i, c));
  }
  dfs(1);
  calc(1);
  cout << ans;
  return 0;
}
