#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const long long inf = 1e15;
int n, a[N], cnt = 0;
vector<pair<int, int> > e[N];
void dfs(int u, int par, long long lim) {
  ++cnt;
  for (int i = 0; i < e[u].size(); ++i) {
    int v = e[u][i].first, w = e[u][i].second;
    if (v == par) continue;
    int newW = max(lim + w, 1ll * w);
    if (newW <= a[v]) dfs(v, u, newW);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    e[u].push_back(pair<int, int>(i, v));
    e[i].push_back(pair<int, int>(u, v));
  }
  dfs(0, 0, 0);
  cout << n - cnt << endl;
  return 0;
}
