#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
long long int u[N];
bool sad[N];
vector<int> g[N];
vector<long long int> w[N];
int sz[N];
void dfs(int x, long long int su, int pai) {
  sz[x] = 1;
  if (su > u[x]) sad[x] = true;
  for (int i = 0; i < g[x].size(); ++i) {
    int y = g[x][i];
    long long int W = w[x][i];
    if (y == pai) continue;
    long long int nw = su + W;
    if (nw < 0LL) nw = 0LL;
    dfs(y, nw, x);
    sz[x] += sz[y];
  }
}
long long int dfs2(int x, int p) {
  if (sad[x]) return (long long int)sz[x];
  long long int ans = 0;
  for (int i = 0; i < g[x].size(); ++i) {
    int y = g[x][i];
    if (y == p) continue;
    ans += dfs2(y, x);
  }
  return ans;
}
int main(void) {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> u[i];
  }
  for (int i = 1; i <= n - 1; ++i) {
    int x, v;
    cin >> x >> v;
    g[i + 1].push_back(x);
    g[x].push_back(i + 1);
    w[i + 1].push_back((long long int)v);
    w[x].push_back((long long int)v);
  }
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  dfs(1, 0LL, -1);
  long long int res = dfs2(1, -1);
  cout << res << endl;
  return 0;
}
