#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9;
const long long INF64 = (long long)1e18;
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4786)
int Set(int N, int pos) { return N = N | (1 << pos); }
int Reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
double dis(int x1, int y1, int x2, int y2) { return hypot(x1 - x2, y1 - y2); }
const int mx = 1 << 29;
long long ans, sum, t, n, k, m, ar[100005];
std::vector<long long> v[100005], e[100005];
int dx[] = {0, 1, -1, 0, 0};
int dy[] = {0, 0, 0, 1, -1};
void rmv(long long id, long long par) {
  if (v[id].size() == 1 && id != 1) {
    ans++;
    return;
  }
  for (int i = 0; i < v[id].size(); i++) {
    if (par == v[id][i]) continue;
    rmv(v[id][i], id);
  }
  ans++;
}
void f(long long id, long long par, long long d, long long g) {
  if (d - g > ar[id]) {
    rmv(id, par);
    return;
  }
  for (int i = 0; i < v[id].size(); i++) {
    if (v[id][i] == par) continue;
    f(v[id][i], id, d + e[id][i], min(g, d + e[id][i]));
  }
}
int main() {
  long long a, b, c;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &ar[i]);
  for (int i = 1; i <= n - 1; i++) {
    scanf("%lld", &b);
    scanf("%lld", &c);
    v[i + 1].push_back(b);
    v[b].push_back(i + 1);
    e[i + 1].push_back(c);
    e[b].push_back(c);
  }
  f(1, 0, 0, 0);
  cout << ans << "\n";
  return 0;
}
