#include <bits/stdc++.h>
using namespace std;
int n, ans = 0;
long long int mn = int(1e9);
vector<int> c, d;
vector<vector<pair<int, int>>> g;
void dfs(int u, int p = 1) {
  d[u] = 1;
  for (auto v : g[u])
    if (v.first != p) {
      dfs(v.first, u);
      d[u] += d[v.first];
    }
  return;
}
void dfs1(int u, int p = 1, long long int dist = 0) {
  if (dist > c[u]) {
    ans += d[u];
    return;
  }
  for (auto v : g[u])
    if (v.first != p) dfs1(v.first, u, max(0LL, dist + v.second));
}
void solve() {
  dfs(1);
  dfs1(1);
  cout << ans << '\n';
  return;
}
void inp() {
  cin >> n;
  c.resize(n + 1), g.resize(n + 1), d.resize(n + 1);
  for (int i = 1; i < n + 1; i++) cin >> c[i];
  for (int i = 1; i < n; i++) {
    int p, w;
    cin >> p >> w;
    g[i + 1].push_back(make_pair(p, w));
    g[p].push_back(make_pair(i + 1, w));
  }
  return;
}
int main() {
  clock_t beg = clock();
  {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
  };
  inp();
  solve();
  clock_t end = clock();
  fprintf(stderr, "%.3f sec\n", (double)(end - beg) / CLOCKS_PER_SEC);
  return 0;
}
