#include <bits/stdc++.h>
using namespace std;
int w[100005];
long long dis[100005] = {0};
int deep[100005];
bool ok[100005] = {0};
struct edge {
  int t;
  int v;
  edge(const int& tt, const int& vv) {
    t = tt;
    v = vv;
  }
};
vector<edge> G[100005];
void dfs(int x) {
  ok[x] = true;
  int n = (int)G[x].size();
  for (int i = 0; i < n; i++) {
    edge& t = G[x][i];
    if (deep[t.t] == -1) {
      deep[t.t] = deep[x] + 1;
      dis[t.t] = max(0LL, dis[x] + t.v);
      if (dis[t.t] <= w[t.t]) dfs(t.t);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &w[i]);
  memset(deep, -1, sizeof(deep));
  for (int i = 1, t, v; i < n; i++) {
    scanf("%d%d", &t, &v);
    G[i + 1].push_back(edge(t, v));
    G[t].push_back(edge(i + 1, v));
  }
  deep[1] = 0;
  dfs(1);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (!ok[i]) ans++;
  printf("%d\n", ans);
}
