#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const long long MOD = 1000000007;
vector<int> cr;
vector<bool> used;
vector<vector<std::pair<long long, long long> > > g;
vector<vector<int> > g2;
set<std::pair<long long, long long> > se;
vector<int> to_remove;
set<int> lev_rem;
vector<long long> dist;
set<int> removed;
void dfs(int s) {
  used[s] = true;
  if (s != 1) {
    auto b = se.begin();
    if (dist[s] - b->first > cr[s] || dist[s] > cr[s]) {
      to_remove.push_back(s);
    }
  }
  for (int i = 0; i < g[s].size(); ++i) {
    if (!used[g[s][i].second]) {
      g2[s].push_back(g[s][i].second);
      dist[g[s][i].second] = dist[s] + g[s][i].first;
      se.insert(std::pair<long long, long long>(dist[g[s][i].second],
                                                g[s][i].second));
      dfs(g[s][i].second);
    }
  }
  if (s != 1) {
    auto w = se.find(std::pair<long long, long long>(dist[s], s));
    se.erase(w);
  }
}
void remove(int s) {
  removed.insert(s);
  for (int i = 0; i < g2[s].size(); ++i) {
    if (lev_rem.find(g2[s][i]) == lev_rem.end()) remove(g2[s][i]);
  }
}
int main() {
  int n;
  cin >> n;
  cr.resize(n + 1);
  g.resize(n + 1);
  g2.resize(n + 1);
  used.resize(n + 1, false);
  dist.resize(n + 1, 0);
  for (long long i = 0; i < (int)n; i++) cin >> cr[i + 1];
  for (long long i = 0; i < (int)n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[i + 2].push_back(std::pair<long long, long long>(b, a));
    g[a].push_back(std::pair<long long, long long>(b, i + 2));
  }
  dfs(1);
  for (long long i = 0; i < (int)to_remove.size(); i++)
    lev_rem.insert(to_remove[i]);
  remove(1);
  cout << n - removed.size() << endl;
  return 0;
}
