#include <bits/stdc++.h>
using namespace std;
void task();
int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  task();
  return 0;
}
const int INF = 0x3f3f3f3f;
const int N = 3e5 + 10;
const int M = 3e5 + 10;
struct S {
  int to;
  long long int w;
};
int n;
vector<S> g[N];
int a[N];
int ans = 0;
int sum[N];
int dfs1(int v, int p = -1) {
  sum[v] = 1;
  for (S u : g[v])
    if (u.to != p) {
      sum[v] += dfs1(u.to, v);
    }
  return sum[v];
}
void dfs2(int v, long long int depth = 0, int p = -1) {
  if (depth > a[v]) {
    ans += sum[v];
    return;
  }
  for (S u : g[v])
    if (u.to != p) {
      long long int nextd = max(depth + u.w, u.w);
      dfs2(u.to, nextd, v);
    }
}
void task() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i + 1 < n; ++i) {
    int v, c;
    cin >> v >> c;
    --v;
    g[i + 1].push_back(S{v, c});
    g[v].push_back(S{i + 1, c});
  }
  dfs1(0);
  dfs2(0);
  cout << ans;
}
