#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T a) {
  for (auto i = a.begin(); i != a.end(); i++) cout << *i << " ";
  cout << endl;
}
bool isVowel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true;
  return false;
}
void sync() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
long long int n;
long long int e;
vector<long long int> dis(1000000);
vector<pair<long long int, long long int> > G[1000000];
vector<long long int> number(1000000);
map<long long int, bool> ck;
vector<long long int> child(1000000);
long long int ans;
void dfs(long long int x, long long int par = -1) {
  if (dis[x] > number[x]) {
    ans += (1 + child[x]);
    return;
  }
  for (pair<long long int, long long int> j1 : G[x]) {
    long long int j = j1.first;
    if (j == par) continue;
    dis[j] = max((long long int)0, dis[x]) + j1.second;
    dfs(j, x);
  }
}
long long int dfs1(long long int x, long long int par = -1) {
  for (pair<long long int, long long int> j1 : G[x]) {
    long long int j = j1.first;
    if (j == par) continue;
    child[x] += (1 + dfs1(j, x));
  }
  return child[x];
}
int main() {
  sync();
  cin >> n;
  e = n - 1;
  for (long long int i = 0; i < n; i++) cin >> number[i];
  for (long long int i = 0; i < e; i++) {
    long long int x, y;
    cin >> x >> y;
    x--;
    G[x].push_back({i + 1, y});
    G[i + 1].push_back({x, y});
  }
  dfs1(0);
  dfs(0);
  cout << ans << endl;
}
