#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int mod = 1e9 + 7;
const long long INF = 1e18 + 1;
const long long inf = 1e12 + 1;
const int N = 5e5 + 9;
int n, ans;
int a[N];
vector<pair<int, int> > g[N];
inline void dfs(int v, int p, long long sum, long long mn) {
  ans++;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i].first;
    if (to == p) continue;
    if (sum + g[v][i].second - mn <= a[to]) {
      dfs(to, v, sum + g[v][i].second, min(mn, sum + g[v][i].second));
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i < n; ++i) {
    int p, c;
    cin >> p >> c;
    g[i + 1].push_back({p, c});
    g[p].push_back({i + 1, c});
  }
  dfs(1, 0, 0, 0);
  cout << n - ans;
  exit(0);
}
