#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
long long n, a[N], dp[N], ans, sub[N];
bool mark[N];
vector<pair<long long, long long> > adj[N];
vector<int> vec;
void DFS1(int v) {
  mark[v] = 1;
  for (pair<long long, long long> tmp : adj[v]) {
    int u = tmp.first;
    if (!mark[u]) dp[u] = max((long long)0, dp[v] + tmp.second), DFS1(u);
  }
}
void DFS2(int v) {
  mark[v] = 1;
  sub[v] = 1;
  for (pair<long long, long long> tmp : adj[v])
    if (!mark[tmp.first]) DFS2(tmp.first), sub[v] += sub[tmp.first];
  if (dp[v] > a[v]) ans += sub[v], sub[v] = 0;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int x, c;
    cin >> x >> c;
    adj[i].push_back({--x, c});
    adj[x].push_back({i, c});
  }
  DFS1(0);
  memset(mark, 0, sizeof mark);
  DFS2(0);
  cout << ans << endl;
}
