#include <bits/stdc++.h>
using namespace std;
int a[100005];
vector<pair<int, int> > adj[100005];
long long dist[100005];
int sum[100005];
int dfs(int node, int par, long long tot) {
  dist[node] = tot;
  sum[node] = 1;
  for (int i = 0; i < adj[node].size(); i++)
    if (adj[node][i].first != par) {
      sum[node] +=
          dfs(adj[node][i].first, node, max(0LL, tot + adj[node][i].second));
    }
  return sum[node];
}
long long solve(int node, int par) {
  if (dist[node] > a[node]) return sum[node];
  long long ret = 0;
  for (int i = 0; i < adj[node].size(); i++)
    if (adj[node][i].first != par) {
      ret += solve(adj[node][i].first, node);
    }
  return ret;
}
int main() {
  int n, vertex, cost;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &vertex, &cost);
    vertex--;
    adj[vertex].push_back(make_pair(i, cost));
    adj[i].push_back(make_pair(vertex, cost));
  }
  dfs(0, -1, 0);
  long long res = solve(0, -1);
  printf("%I64d\n", res);
}
