#include <bits/stdc++.h>
using namespace std;
long long maxi(long long a, long long b) {
  if (a > b) {
    return a;
  }
  return b;
}
long long ans = 0;
vector<long long> cant(1e5, -1);
vector<long long> dist(1e5, 0);
vector<long long> vs;
vector<vector<pair<long long, long long>>> adj(1e5);
long long leaves(long long v, long long pre) {
  if (cant[v] != -1) {
    return cant[v];
  }
  cant[v] = 1;
  for (auto x : adj[v]) {
    if (x.first != pre) {
      cant[v] += leaves(x.first, v);
    }
  }
  return cant[v];
}
void dfs(long long v, long long pre) {
  for (auto x : adj[v]) {
    if (x.first != pre) {
      dist[x.first] = maxi(dist[v] + x.second, 0);
      dfs(x.first, v);
    }
  }
}
void dfs1(long long v, long long pre) {
  if (dist[v] > vs[v]) {
    ans += cant[v];
  } else {
    for (auto x : adj[v]) {
      if (x.first != pre) {
        dfs1(x.first, v);
      }
    }
  }
}
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    vs.push_back(a);
  }
  for (int j = 0; j < n - 1; j++) {
    long long a, b;
    cin >> a >> b;
    a -= 1;
    adj[a].push_back({j + 1, b});
    adj[j + 1].push_back({a, b});
  }
  long long k = leaves(0, -1);
  dfs(0, -1);
  dfs1(0, -1);
  cout << ans << endl;
}
