#include <bits/stdc++.h>
using namespace std;
vector<int> a[100001], cp[100001];
long long t, f[100001];
int cc, c[100001], n, i, u, kq, sl[100001];
void dfs(int u, int p) {
  for (int i = 0; i < a[u].size(); i++) {
    int v = a[u][i];
    if (v == p) continue;
    f[v] = min(f[u], t + cp[u][i]);
    t += cp[u][i];
    dfs(v, u);
    t -= cp[u][i];
  }
}
void DFS(int u, int p) {
  sl[u] = 1;
  for (int i = 0; i < a[u].size(); i++) {
    int v = a[u][i];
    if (v == p) continue;
    t += cp[u][i];
    DFS(v, u);
    t -= cp[u][i];
    sl[u] += sl[v];
  }
  if (t - c[u] > f[p]) {
    kq += sl[u];
    sl[u] = 0;
  }
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> c[i];
  for (i = 1; i < n; i++) {
    cin >> u >> cc;
    a[u].push_back(i + 1);
    a[i + 1].push_back(u);
    cp[u].push_back(cc);
    cp[i + 1].push_back(cc);
  }
  dfs(1, 0);
  f[0] = round(1e18) + 1;
  DFS(1, 0);
  cout << kq;
}
