#include <bits/stdc++.h>
using namespace std;
struct edge {
  int next;
  long long cost;
};
long long dist[101010];
long long a[101010];
vector<edge> g[101010];
bool used[101010];
void dfs(int curr, long long mn) {
  for (auto e : g[curr]) {
    dist[e.next] = dist[curr] + e.cost;
    dfs(e.next, min(mn, dist[curr]));
  }
  if (dist[curr] - a[curr] > mn) {
    used[curr] = true;
  }
}
int dfs2(int curr) {
  if (used[curr]) return 0;
  int res = 1;
  for (auto e : g[curr]) {
    res += dfs2(e.next);
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    int p, c;
    scanf("%d %d", &p, &c);
    g[p - 1].push_back({i, c});
  }
  dfs(0, 1e18);
  cout << n - dfs2(0) << endl;
}
