#include <bits/stdc++.h>
using namespace std;
template <class T>
T mceil(T a, T b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
const long long int M = 1e9 + 7;
const long long int N = 2e5 + 5;
const long long int inf = 9e18;
vector<long long int> pre, a;
vector<vector<pair<long long int, long long int>>> adj;
set<long long int> ans;
void dfs(long long int cur, long long int par) {
  for (pair<long long int, long long int> nb : adj[cur]) {
    if (nb.first != par) {
      pre[nb.first] = max(pre[cur] + nb.second + pre[nb.first], pre[nb.first]);
      dfs(nb.first, cur);
    }
  }
  if (pre[cur] > a[cur]) ans.insert(cur);
}
vector<long long int> rem;
void dfs2(long long int cur, long long int par) {
  if (ans.count(cur)) return;
  rem.push_back(cur);
  for (pair<long long int, long long int> nb : adj[cur]) {
    if (nb.first != par) {
      dfs2(nb.first, cur);
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  adj.resize(n + 1);
  a.resize(n + 1);
  pre.resize(n + 1);
  for (long long int i = 1; i < n + 1; i++) cin >> a[i];
  for (long long int i = 2; i < n + 1; i++) {
    long long int pi, wi;
    cin >> pi >> wi;
    adj[i].push_back({pi, wi});
    adj[pi].push_back({i, wi});
  }
  dfs(1, 0);
  dfs2(1, 0);
  cout << n - (int)((rem).size()) << "\n";
}
