#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int n, x, y;
int a[maxn], st[maxn], en[maxn];
bool vis[maxn];
vector<pair<int, int>> v[maxn];
int pos;
void dfs1(int nod) {
  st[nod] = pos;
  vis[nod] = 1;
  pos++;
  for (int i = 0; i < v[nod].size(); i++) {
    if (vis[v[nod][i].first]) continue;
    dfs1(v[nod][i].first);
  }
  en[nod] = pos;
}
int ans;
int u, ww;
void dfs(int nod, int dis) {
  if (a[nod] < dis) {
    ans += en[nod] - st[nod];
    return;
  }
  dis = max(dis, 0);
  vis[nod] = 1;
  for (int i = 0; i < v[nod].size(); i++) {
    u = v[nod][i].first, ww = v[nod][i].second;
    if (vis[u]) continue;
    dfs(u, dis + ww);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i <= n; i++) {
    cin >> x >> y;
    v[i].push_back({x, y});
    v[x].push_back({i, y});
  }
  dfs1(1);
  memset(vis, 0, sizeof vis);
  dfs(1, 0);
  cout << ans << endl;
  return 0;
}
