#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long dx[] = {-1, 0, 1, 0};
long long dy[] = {0, -1, 0, 1};
vector<pair<long long, long long> > g[100005];
vector<long long> sz(100005);
vector<long long> val(100005);
void dfs1(long long x, long long p) {
  sz[x] = 1;
  for (auto i : g[x]) {
    if (i.first != p) {
      dfs1(i.first, x);
      sz[x] += sz[i.first];
    }
  }
}
long long ans;
void dfs2(long long x, long long p, long long v, long long mn = 0) {
  if (x != 1) {
    if (v - mn > val[x]) {
      ans += sz[x];
      return;
    }
  }
  for (auto i : g[x]) {
    if (i.first != p) {
      long long z = min(mn, v);
      dfs2(i.first, x, v + i.second, z);
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> val[i];
  for (long long i = 1; i <= n - 1; i++) {
    long long x, c;
    cin >> x >> c;
    g[i + 1].push_back({x, c});
    g[x].push_back({i + 1, c});
  }
  dfs1(1, -1);
  long long v = 0;
  dfs2(1, -1, v);
  cout << ans << "\n";
}
