#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<pair<int, int>> adj[N];
int a[N];
bool vis[N];
int dfs(long long dist, int v) {
  vis[v] = true;
  if (a[v] < dist) return 0;
  int ret = 1;
  for (int i = 0; i < adj[v].size(); i++)
    if (!vis[adj[v][i].first]) {
      ret += dfs(max(0ll, dist + adj[v][i].second), adj[v][i].first);
    }
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) vis[i] = false;
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int i = 2; i <= n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    adj[i].push_back({x, y});
    adj[x].push_back({i, y});
  }
  printf("%d\n", n - dfs(0, 1));
}
