#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, long long> > > a;
vector<int> us, q, sz;
set<long long> w;
map<long long, int> e;
int ans = 0;
void dfs(int v) {
  if (us[v]) return;
  us[v] = 1;
  for (int i = 0; i < a[v].size(); i++) {
    bool k = 0;
    if (!us[a[v][i].first]) k = 1;
    dfs(a[v][i].first);
    if (k) sz[v] += sz[a[v][i].first];
  }
  return;
}
void dfsb(int v, long long sum) {
  if (us[v]) return;
  us[v] = 1;
  set<long long>::iterator j = w.lower_bound(sum - q[v]);
  if (j != w.begin()) {
    ans += sz[v];
    return;
  }
  for (int i = 0; i < a[v].size(); i++) {
    w.insert(sum + a[v][i].second);
    e[sum + a[v][i].second]++;
    dfsb(a[v][i].first, sum + a[v][i].second);
    e[sum + a[v][i].second]--;
    if (!e[sum + a[v][i].second]) w.erase(sum + a[v][i].second);
  }
  return;
}
int main() {
  int n;
  cin >> n;
  a.resize(n);
  us.resize(n, 0);
  q.resize(n);
  sz.resize(n, 1);
  for (int i = 0; i < n; i++) {
    cin >> q[i];
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    a[i + 1].push_back({x, y});
    a[x].push_back({i + 1, y});
  }
  dfs(0);
  us.clear();
  us.resize(n, 0);
  e[0]++;
  w.insert(0);
  dfsb(0, 0);
  cout << ans;
  return 0;
}
