#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.1415926535897923846;
const long long int MOD = 1000000007;
const long long int N = 998244353;
long long int power(long long int x, long long int n) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
long long int modinverse(long long int a) { return power(a, MOD - 2); }
vector<vector<pair<long long int, long long int>>> adj;
vector<long long int> a;
long long int n;
vector<long long int> sz;
long long int dfs(long long int node, long long int parent) {
  long long int nas = 1;
  for (auto xx : adj[node]) {
    long long int x = xx.first;
    if (x != parent) nas += dfs(x, node);
  }
  sz[node] = nas;
  return nas;
}
long long int ddfs(long long int node, long long int cur,
                   long long int parent) {
  long long int nas = 0;
  for (auto xx : adj[node]) {
    long long int x = xx.first;
    long long int weight = xx.second;
    if (x == parent) continue;
    long long int dish = cur + weight;
    if (dish > a[x]) {
      nas += sz[x];
    } else {
      dish -= weight;
      dish = max({0LL, weight, dish + weight});
      nas += ddfs(x, dish, node);
    }
  }
  return nas;
}
void solve() {
  cin >> n;
  a.resize(n);
  adj.resize(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long int i = 0; i < n - 1; i++) {
    long long int u, x;
    cin >> u >> x;
    --u;
    adj[i + 1].push_back({u, x});
    adj[u].push_back({i + 1, x});
  }
  sz.resize(n);
  dfs(0, -1);
  cout << ddfs(0, 0, -1) << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int test = 1;
  while (test--) {
    solve();
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
