#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<pair<int, int> > > gr;
vector<int> dsts;
int sz_dfs(int v) {
  int ans = 1;
  for (auto it : gr[v]) ans += sz_dfs(it.first);
  return ans;
}
void dfs(int v, int64_t mx_dist, int& ans) {
  if (mx_dist > dsts[v]) {
    ans += sz_dfs(v);
    return;
  }
  if (mx_dist < 0) mx_dist = 0;
  for (auto it : gr[v]) dfs(it.first, mx_dist + it.second, ans);
}
void solve(void) {
  cin >> n;
  gr.resize(n);
  dsts.resize(n);
  for (int& dst : dsts) cin >> dst;
  for (int i = 1; i < n; ++i) {
    int a, p;
    cin >> a >> p;
    gr[a - 1].push_back({i, p});
  }
  int ans = 0;
  dfs(0, 0, ans);
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  solve();
  return 0;
}
