#include <bits/stdc++.h>
using namespace std;
inline void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
vector<pair<long long int, int>> adj[100005];
long long int d[100005];
int ans = 0;
void dfs(int u, int p, long long int sum) {
  if (sum > d[u]) return;
  ans++;
  for (auto it : adj[u]) {
    if (it.second == p) continue;
    dfs(it.second, u, max(sum + it.first, 0LL));
  }
}
int main() {
  fast();
  int n, a, w;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> d[i];
  for (int i = 2; i <= n; i++) {
    cin >> a >> w;
    adj[i].push_back(make_pair(w, a));
    adj[a].push_back(make_pair(w, i));
  }
  dfs(1, 0, 0LL);
  cout << n - ans << endl;
}
