#include <bits/stdc++.h>
using namespace std;
int visit[100004];
vector<vector<pair<int, int> > > op(100004);
int num[100004];
void dfs(int node, int now_vis, long long now_sum) {
  if (now_sum > num[node]) now_vis = 2;
  visit[node] = now_vis;
  int i;
  for (i = 0; i < op[node].size(); i++) {
    int u = op[node][i].first;
    int c = op[node][i].second;
    if (!visit[u]) dfs(u, now_vis, max(now_sum + c, 0ll));
  }
}
int main() {
  int n;
  cin >> n;
  int i;
  for (i = 1; i <= n; i++) cin >> num[i];
  for (i = 1; i < n; i++) {
    int h = i + 1;
    int x, y;
    cin >> x >> y;
    op[x].push_back(make_pair(h, y));
    op[h].push_back(make_pair(x, y));
  }
  dfs(1, 1, 0);
  long long res = 0;
  for (i = 1; i <= n; i++)
    if (visit[i] == 2) res++;
  cout << res;
  return 0;
}
