#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100500;
map<pair<int, int>, int> m;
vector<int> g[MAXN];
int a[MAXN];
bool used[MAXN];
int ans;
bool ok[MAXN];
long long d[MAXN];
void dfs(int v, int p) {
  used[v] = 1;
  d[v] = max(0ll, d[v]);
  if ((d[v] > a[v] || ok[p]) && p != -1) {
    ok[v] = 1;
    ans++;
  }
  for (int i = 0; i < g[v].size(); i++) {
    int to = g[v][i];
    if (p == to) continue;
    d[to] = d[v] + m[{min(v, to), max(v, to)}];
    if (!used[to]) dfs(to, v);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i < n; i++) {
    int x, val;
    cin >> x >> val;
    g[x].push_back(i + 1);
    g[i + 1].push_back(x);
    m[{min(x, i + 1), max(i + 1, x)}] = val;
  }
  dfs(1, -1);
  cout << ans;
  return 0;
}
