#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline T gcd(T a, T b) {
  return __gcd(a, b);
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
long long modpow(long long a, long long n, long long temp) {
  long long res = 1, y = a;
  while (n > 0) {
    if (n & 1) res = (res * y) % temp;
    y = (y * y) % temp;
    n /= 2;
  }
  return res % temp;
}
long long ison(long long mask, long long pos) { return (mask & (1 << pos)); }
long long cbit(long long n) {
  long long k = 0;
  while (n) n &= (n - 1), k++;
  return k;
}
long long nbit(long long n) {
  long long k = 0;
  while (n) n /= 2, k++;
  return k;
}
long long mod = 1e9 + 7;
int sgn(long long x) { return x < 0 ? -1 : !!x; }
long long xo(long long i) {
  if ((i & 3) == 0) return i;
  if ((i & 3) == 1) return 1;
  if ((i & 3) == 2) return i + 1;
  return 0;
}
vector<pair<long long, long long> > adj[100005];
long long vis[100005];
long long mark[100005];
long long a[100005];
void dfs(long long v, long long p, long long dis) {
  if (dis > a[v]) {
    mark[v] = -1;
    return;
  }
  vis[v] = 1;
  for (long long i = 0; i < adj[v].size(); i++) {
    if (adj[v][i].first != p && mark[adj[v][i].first] != -1) {
      if (dis + adj[v][i].second > 0)
        dfs(adj[v][i].first, v, dis + adj[v][i].second);
      else
        dfs(adj[v][i].first, v, 0);
    }
  }
}
int main() {
  long long ans = 0, i, j, k, l, m, n;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n - 1; i++) {
    long long x, w;
    cin >> x >> w;
    adj[i + 1].push_back(make_pair(x, w));
    adj[x].push_back(make_pair(i + 1, w));
  }
  dfs(1, -1, 0);
  for (i = 1; i <= n; i++) ans += (vis[i] == 0);
  cout << ans;
}
