#include <bits/stdc++.h>
using namespace std;
long long inv(long long a, long long p) {
  long long temp = 1;
  while (p != 0) {
    if (p % 2 == 1) temp = (temp * a) % 1000000007;
    a = ((long long)a * a) % 1000000007;
    p = p / 2;
  }
  return temp;
}
vector<int> ne[100001];
vector<int> ne1[100001];
int val[100005];
int n;
int v[100005] = {};
long long dis[100005] = {};
void dfs(int c, int p, int d) {
  if (dis[p] < 0)
    dis[c] = d;
  else
    dis[c] = dis[p] + d;
  if (dis[c] > val[c])
    return;
  else
    v[c] = 1;
  for (int i = 0; i < ne[c].size(); i++) {
    if (v[ne[c][i]] == 0) {
      dfs(ne[c][i], c, ne1[c][i]);
    }
  }
  return;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> val[i];
  }
  for (int i = 1; i <= n; i++) v[i] = 0;
  for (int i = 1; i < n; i++) {
    int num, d;
    cin >> num >> d;
    ne[i + 1].push_back(num);
    ne[num].push_back(i + 1);
    ne1[i + 1].push_back(d);
    ne1[num].push_back(d);
  }
  v[1] = 1;
  for (int i = 0; i < ne[1].size(); i++) {
    dfs(ne[1][i], 1, ne1[1][i]);
  }
  int count = 0;
  for (int i = 1; i <= n; i++) {
    if (v[i] == 1) count++;
  }
  cout << n - count;
  return 0;
}
