#include <bits/stdc++.h>
using namespace std;
long long head[100010], lee[100010], num[100010], ans;
vector<int> hh[100010];
void dfss(int x) {
  long long leng = hh[x].size();
  if (!leng) {
    num[x] = 1;
    return;
  }
  for (int i = 0; i < leng; i++) {
    dfss(hh[x][i]);
    num[x] += num[hh[x][i]];
  }
  num[x]++;
}
void dfs(long long x, long long res) {
  if (head[x] < res) {
    ans += num[x];
    return;
  }
  for (int i = 0; i < hh[x].size(); i++) {
    long long tmp = max(res + lee[hh[x][i]], lee[hh[x][i]]);
    dfs(hh[x][i], tmp);
  }
}
int main() {
  long long t, x, y;
  cin >> t;
  for (int i = 1; i <= t; i++) cin >> head[i];
  for (int i = 2; i <= t; i++) {
    cin >> x >> y;
    lee[i] = y;
    hh[x].push_back(i);
  }
  dfss(1);
  dfs(1, 0);
  cout << ans << endl;
  return 0;
}
