#include <bits/stdc++.h>
using namespace std;
typedef struct lol {
  int dest;
  int w;
} edge;
vector<vector<edge> > arvore;
int* labelsNos;
int* visited;
int visitados;
void dfs(int v, long long int acumulado) {
  unsigned int it;
  edge e;
  long long int acc;
  visited[v] = 1;
  if (acumulado > labelsNos[v]) {
    return;
  }
  visitados++;
  for (it = 0; it < arvore[v].size(); it++) {
    e = arvore[v][it];
    if (!visited[e.dest]) {
      acc = acumulado + e.w;
      if (acc >= 0) {
        dfs(e.dest, acc);
      } else {
        dfs(e.dest, 0);
      }
    }
  }
}
int main() {
  int n;
  int i;
  int aux;
  vector<edge> auxVector;
  cin >> n;
  labelsNos = (int*)malloc((n + 1) * sizeof(int));
  visited = (int*)malloc((n + 1) * sizeof(int));
  for (i = 1; i <= n; i++) {
    cin >> aux;
    labelsNos[i] = aux;
    arvore.push_back(auxVector);
    visited[i] = 0;
  }
  arvore.push_back(auxVector);
  int dest;
  int w;
  edge edgeAux;
  for (i = 1; i <= n - 1; i++) {
    cin >> dest;
    cin >> w;
    edgeAux.dest = dest;
    edgeAux.w = w;
    arvore[i + 1].push_back(edgeAux);
    edgeAux.dest = i + 1;
    arvore[dest].push_back(edgeAux);
  }
  visitados = 0;
  dfs(1, 0);
  cout << n - visitados << endl;
  return 0;
}
