import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C358_AlonyaTree {
	static ArrayList<Node> al[];
	static boolean visited[];
	static long size[];
	static long cnt;
	static boolean f[];
	static long dp[];
	static int a[];

	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		// StringBuilder sb = new StringBuilder();
		// ----------My Code----------

		int n = in.nextInt();
		a = new int[n];
		al = new ArrayList[n];

		dp = new long[n];
		dp[0] = 0;

		visited = new boolean[n];
		Arrays.fill(visited, false);

		f = new boolean[n];
		Arrays.fill(f, true);

		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
			al[i] = new ArrayList<Node>();
		}
		for (int i = 1; i < n; i++) {
			al[in.nextInt() - 1].add(new Node(i, in.nextInt()));
		}
		size = new long[n];
		getSize(al, 0);
		cnt = 0;

		dfs(0,0);

		// cnt=0;

		out.println(cnt);

		// ---------------The End------------------

		out.close();
	}

	public static long getSize(ArrayList<Node>[] graph, int start) {
		size[start] = 1;
		for (Node neighbours : graph[start])
			size[start] += getSize(graph, neighbours.u);
		return size[start];
	}

	static void dfs(int i, long minVal) {

		if (dp[i] - minVal > a[i]) {
			cnt += size[i];
			return;
		}
		for (int j = 0; j < al[i].size(); j++) {
			int u = al[i].get(j).u;
			long val = al[i].get(j).val;
			dp[u] = dp[i] + val;
			minVal=Math.min(minVal, dp[i]);
			dfs(u, minVal);

		}
	}

	static class Node {
		int u;
		long val;

		public Node(int u, long val) {
			super();
			this.u = u;
			this.val = val;
		}

	}
	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    static int MAX = 1000;
    int[] v;
    int[] e;
    int[] p;
    List<List<Vect>> g = new ArrayList<>();
    boolean used[];

    public void solve(Scanner in, PrintWriter out) {
        int n = in.nextInt();
        used = new boolean[n];
        Arrays.fill(used, false);
        v = new int[n];
        p = new int[n];
        e = new int[n];
        for (int i = 0; i < n; i++) {
            v[i] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < n - 1; i++) {
            p[i + 1] = in.nextInt() - 1;
            e[i + 1] = in.nextInt();
            g.get(p[i + 1]).add(new Vect(i + 1, e[i+1]));
        }
        dfs(0, 0, 0);
        System.out.println(res);
    }

    int res = 0;
    void dfs(int k, long pot, long d) {
        List<Vect> children = g.get(k);
        if (used[k]) {
            for (Vect vect : children) {
                used[vect.a] = true;
                res++;
                dfs(vect.a, -1, -1);
            }
            return;
        }
        for (Vect c : children) {
            if (d + c.b - pot > v[c.a]) {
                used[c.a] = true;
                res++;
            }
            dfs(c.a, Math.min(pot, d + c.b), d + c.b);
        }
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;

        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid - 1;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Pair<T, U> {
    public T a;
    public U b;

    public Pair(T a, U b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public boolean equals(Object obj) {
        Pair<T, U> p = (Pair<T, U>) obj;
        return p.a.equals(a) || p.a.equals(b);
    }

    @Override
    public int hashCode() {
        return 42;
    }
}

class Vect {
    public int a;
    public int b;

    public Vect(int a, int b) {
        this.a = a;
        this.b = b;
    }
}

class Triple<T, U, P> {
    public T a;
    public U b;
    public P c;

    public Triple(T a, U b, P c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
}

class Task {

    static int MAX = 1000;
    int[] v;
    int[] e;
    int[] p;
    List<List<Vect>> g = new ArrayList<>();
    boolean used[];

    public void solve(Scanner in, PrintWriter out) {
        int n = in.nextInt();
        used = new boolean[n];
        Arrays.fill(used, false);
        v = new int[n];
        p = new int[n];
        e = new int[n];
        for (int i = 0; i < n; i++) {
            v[i] = in.nextInt();
        }
        for (int i = 0; i < n; i++) {
            g.add(new ArrayList<>());
        }
        for (int i = 0; i < n - 1; i++) {
            p[i + 1] = in.nextInt() - 1;
            e[i + 1] = in.nextInt();
            g.get(p[i + 1]).add(new Vect(i + 1, e[i+1]));
        }
        dfs(0, 0, 0);
        System.out.println(res);
    }

    int res = 0;
    void dfs(int k, int pot, int d) {
        List<Vect> children = g.get(k);
        if (used[k]) {
            for (Vect vect : children) {
                used[vect.a] = true;
                res++;
                dfs(vect.a, -1, -1);
            }
            return;
        }
        for (Vect c : children) {
            if (d + c.b - pot > v[c.a]) {
                used[c.a] = true;
                res++;
            }
            dfs(c.a, Math.min(pot, d + c.b), d + c.b);
        }
    }

}

class Utils {

    public static int binarySearch(int[] a, int key) {
        int s = 0;
        int f = a.length;

        while (f > s) {
            int mid = (s + f) / 2;
            if (a[mid] > key) {
                f = mid - 1;
            } else if (a[mid] <= key) {
                s = mid + 1;
            }
        }
        return -1;
    }
}

class Pair<T, U> {
    public T a;
    public U b;

    public Pair(T a, U b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public boolean equals(Object obj) {
        Pair<T, U> p = (Pair<T, U>) obj;
        return p.a.equals(a) || p.a.equals(b);
    }

    @Override
    public int hashCode() {
        return 42;
    }
}

class Vect {
    public int a;
    public int b;

    public Vect(int a, int b) {
        this.a = a;
        this.b = b;
    }
}

class Triple<T, U, P> {
    public T a;
    public U b;
    public P c;

    public Triple(T a, U b, P c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }
}

class Scanner {
    BufferedReader in;
    StringTokenizer tok;

    public Scanner(InputStream in) {
        this.in = new BufferedReader(new InputStreamReader(in));
        tok = new StringTokenizer("");
    }

    private String tryReadNextLine() {
        try {
            return in.readLine();
        } catch (Exception e) {
            throw new InputMismatchException();
        }
    }

    public String nextToken() {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(next());
        }
        return tok.nextToken();
    }

    public String next() {
        String newLine = tryReadNextLine();
        if (newLine == null)
            throw new InputMismatchException();
        return newLine;
    }

    public int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() {
        return Long.parseLong(nextToken());
    }
}


import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;

import java.io.*;

public class Main {

	void solve() {
		int n = sc.nextInt();

		V[] vs = new V[n];
		for (int i = 0; i < n; i++) {
			vs[i] = new V();
			vs[i].id = i + 1;
		}
		for (int i = 0; i < n; i++) {
			vs[i].a = sc.nextInt();
		}
		for (int i = 1; i < n; i++) {
			int parent = sc.nextInt() - 1;
			int cost = sc.nextInt();
			vs[parent].add(vs[i], cost);
		}
		ans = 0;
		dfs(vs[0], 0, false);
		out.println(ans);
	}

	int ans = 0;
	void dfs(V v, long dist, boolean inf) {
		if (dist > v.a || inf) {
			ans++;
//			tr(v.id);
			inf = true;
		}
		for (E e : v.es) {
			dfs(e.to, Math.max(0, dist) + e.w, inf);
		}
	}

	class V {
		ArrayList<E> es = new ArrayList<E>();
		int id;
		long a;
		void add(V to, int w) {
			this.es.add(new E(to, w));
		}
	}
	class E {
		V to;
		int w;
		E(V to, int w) {
			this.to = to;
			this.w = w;
		}
	}

	static void tr(Object... os) { System.err.println(deepToString(os)); }
	static void tr(int[][] as) { for (int[] a : as) tr(a); }

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}


import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;

import java.io.*;

public class Main {

	void solve() {
		int n = sc.nextInt();

		V[] vs = new V[n];
		for (int i = 0; i < n; i++) vs[i] = new V();
		for (int i = 0; i < n; i++) {
			vs[i].a = sc.nextInt();
		}
		for (int i = 1; i < n; i++) {
			int parent = sc.nextInt() - 1;
			int cost = sc.nextInt();
			vs[parent].add(vs[i], cost);
		}
		ans = 0;
		dfs(vs[0], 0);
		out.println(ans);
	}

	int ans = 0;
	long dfs(V v, long dist) {
		long c = 0;
		for (E e : v.es) {
			c += dfs(e.to, dist + e.w);
		}
		if (dist > v.a) {
			ans++;
			return 0;
		} else {
			return c;
		}
	}

	class V {
		ArrayList<E> es = new ArrayList<E>();
		long a;
		void add(V to, int w) {
			this.es.add(new E(to, w));
		}
	}
	class E {
		V to;
		int w;
		E(V to, int w) {
			this.to = to;
			this.w = w;
		}
	}

	static void tr(Object... os) { System.err.println(deepToString(os)); }
	static void tr(int[][] as) { for (int[] a : as) tr(a); }

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}


import static java.lang.Math.*;
import static java.util.Arrays.*;
import java.util.*;

import java.io.*;

public class Main {

	void solve() {
		int n = sc.nextInt();

		V[] vs = new V[n];
		for (int i = 0; i < n; i++) {
			vs[i] = new V();
			vs[i].id = i + 1;
		}
		for (int i = 0; i < n; i++) {
			vs[i].a = sc.nextInt();
		}
		for (int i = 1; i < n; i++) {
			int parent = sc.nextInt() - 1;
			int cost = sc.nextInt();
			vs[parent].add(vs[i], cost);
		}
		ans = 0;
		dfs(vs[0], 0, false);
		out.println(ans);
	}

	int ans = 0;
	void dfs(V v, long dist, boolean inf) {
		if (dist > v.a || inf) {
			ans++;
//			tr(v.id);
			inf = true;
		}
		for (E e : v.es) {
			dfs(e.to, dist + e.w, inf);
		}
	}

	class V {
		ArrayList<E> es = new ArrayList<E>();
		int id;
		long a;
		void add(V to, int w) {
			this.es.add(new E(to, w));
		}
	}
	class E {
		V to;
		int w;
		E(V to, int w) {
			this.to = to;
			this.w = w;
		}
	}

	static void tr(Object... os) { System.err.println(deepToString(os)); }
	static void tr(int[][] as) { for (int[] a : as) tr(a); }

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++) out.print(" " + a[i]);
		out.println();
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            Node[] tree = input(in);
            int left = dfs2(tree[1], 0);
            int result = tree.length - 1 - left;
            out.print(Math.max(1, result));
        }

        private int dfs2(Node cur, long curLen) {
            int subtreeSize = 1;
            for (Edge e : cur.children) {
                subtreeSize += dfs2(e.second, curLen + e.number);
            }

            if (cur.number < curLen) {
                subtreeSize = 0;
            }

            return subtreeSize;
        }

        private void dfs(Node current) {
            Node parent = current.parent;
            List<Edge> edges = new ArrayList<>(current.children);
            current.children.clear();
            for (Edge e : edges) {
                Node to = e.second;
                if (to != parent) {
                    to.parent = current;
                    current.children.add(new Edge(current, to, e.number));
                    dfs(to);
                }
            }
        }

        private Node[] input(InputReader in) {
            int n = in.readInt();
            Node[] tree = new Node[n + 1];
            for (int i = 1; i <= n; i++) {
                tree[i] = new Node(i, in.readInt());
            }
            for (int i = 2; i <= n; i++) {
                int p = in.readInt();
                int c = in.readInt();
                tree[p].children.add(new Edge(tree[p], tree[i], c));
                tree[i].children.add(new Edge(tree[i], tree[p], c));
            }
            dfs(tree[1]);
            return tree;
        }

    }

    static class Edge {
        public final Node first;
        public final Node second;
        public final long number;

        public Edge(Node first, Node second, long number) {
            this.first = first;
            this.second = second;
            this.number = number;
        }

        public String toString() {
            return second.index + " " + number;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class Node {
        public final int index;
        public Node parent;
        public final List<Edge> children = new ArrayList<>();
        public final int number;

        public Node(int index, int number) {
            this.index = index;
            this.number = number;
        }

        public String toString() {
            return index + " " + number;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            Node[] tree = input(in);
            int left = dfs2(tree[1], 0);
            out.print(tree.length - 1 - left);
        }

        private int dfs2(Node cur, long curLen) {
            int subtreeSize = 1;
            for (Edge e : cur.children) {
                subtreeSize += dfs2(e.second, curLen + e.number);
            }

            if (cur.number < curLen) {
                subtreeSize = 0;
            }

            return subtreeSize;
        }

        private void dfs(Node current) {
            Node parent = current.parent;
            List<Edge> edges = new ArrayList<>(current.children);
            current.children.clear();
            for (Edge e : edges) {
                Node to = e.second;
                if (to != parent) {
                    to.parent = current;
                    current.children.add(new Edge(current, to, e.number));
                    dfs(to);
                }
            }
        }

        private Node[] input(InputReader in) {
            int n = in.readInt();
            Node[] tree = new Node[n + 1];
            for (int i = 1; i <= n; i++) {
                tree[i] = new Node(i, in.readInt());
            }
            for (int i = 2; i <= n; i++) {
                int p = in.readInt();
                int c = in.readInt();
                tree[p].children.add(new Edge(tree[p], tree[i], c));
                tree[i].children.add(new Edge(tree[i], tree[p], c));
            }
            dfs(tree[1]);
            return tree;
        }

    }

    static class Edge {
        public final Node first;
        public final Node second;
        public final int number;

        public Edge(Node first, Node second, int number) {
            this.first = first;
            this.second = second;
            this.number = number;
        }

        public String toString() {
            return second.index + " " + number;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class Node {
        public final int index;
        public Node parent;
        public final List<Edge> children = new ArrayList<>();
        public final int number;

        public Node(int index, int number) {
            this.index = index;
            this.number = number;
        }

        public String toString() {
            return index + " " + number;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.List;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            Node[] tree = input(in);
            int left = dfs2(tree[1], 0);
            out.print(tree.length - 1 - left);
        }

        private int dfs2(Node cur, int curLen) {
            int subtreeSize = 1;
            for (Edge e : cur.children) {
                subtreeSize += dfs2(e.second, curLen + e.number);
            }

            if (cur.number < curLen) {
                subtreeSize = 0;
            }

            return subtreeSize;
        }

        private void dfs(Node current) {
            Node parent = current.parent;
            List<Edge> edges = new ArrayList<>(current.children);
            current.children.clear();
            for (Edge e : edges) {
                Node to = e.second;
                if (to != parent) {
                    to.parent = current;
                    current.children.add(new Edge(current, to, e.number));
                    dfs(to);
                }
            }
        }

        private Node[] input(InputReader in) {
            int n = in.readInt();
            Node[] tree = new Node[n + 1];
            for (int i = 1; i <= n; i++) {
                tree[i] = new Node(i, in.readInt());
            }
            for (int i = 2; i <= n; i++) {
                int p = in.readInt();
                int c = in.readInt();
                tree[p].children.add(new Edge(tree[p], tree[i], c));
                tree[i].children.add(new Edge(tree[i], tree[p], c));
            }
            dfs(tree[1]);
            return tree;
        }

    }

    static class Edge {
        public final Node first;
        public final Node second;
        public final int number;

        public Edge(Node first, Node second, int number) {
            this.first = first;
            this.second = second;
            this.number = number;
        }

        public String toString() {
            return second.index + " " + number;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class Node {
        public final int index;
        public Node parent;
        public final List<Edge> children = new ArrayList<>();
        public final int number;

        public Node(int index, int number) {
            this.index = index;
            this.number = number;
        }

        public String toString() {
            return index + " " + number;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            Node[] tree = input(in);
            int left = dfs2(tree[1], 0);
            int result = tree.length - 1 - left;
            out.print(result);
        }

        private int dfs2(Node cur, long curLen) {
            int subtreeSize = 1;
            for (Edge e : cur.children) {
                subtreeSize += dfs2(e.second, Math.max(e.number, curLen + e.number));
            }

            if (cur.number < curLen) {
                subtreeSize = 0;
            }

            return subtreeSize;
        }

        private void dfs(Node current) {
            Node parent = current.parent;
            List<Edge> edges = new ArrayList<>(current.children);
            current.children.clear();
            for (Edge e : edges) {
                Node to = e.second;
                if (to != parent) {
                    to.parent = current;
                    current.children.add(new Edge(current, to, e.number));
                    dfs(to);
                }
            }
        }

        private Node[] input(InputReader in) {
            int n = in.readInt();
            Node[] tree = new Node[n + 1];
            for (int i = 1; i <= n; i++) {
                tree[i] = new Node(i, in.readInt());
            }
            for (int i = 2; i <= n; i++) {
                int p = in.readInt();
                int c = in.readInt();
                tree[p].children.add(new Edge(tree[p], tree[i], c));
                tree[i].children.add(new Edge(tree[i], tree[p], c));
            }
            dfs(tree[1]);
            return tree;
        }

    }

    static class Edge {
        public final Node first;
        public final Node second;
        public final long number;

        public Edge(Node first, Node second, long number) {
            this.first = first;
            this.second = second;
            this.number = number;
        }

        public String toString() {
            return second.index + " " + number;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class Node {
        public final int index;
        public Node parent;
        public final List<Edge> children = new ArrayList<>();
        public final int number;

        public Node(int index, int number) {
            this.index = index;
            this.number = number;
        }

        public String toString() {
            return index + " " + number;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

    }
}


import java.util.Scanner;

public class Tester {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		long node[] = new long[n+1];
		long nextnode[] = new long[n+1];
		long edge[] = new long[n+1];
		int count = 0;
		node[0] = 0;
		nextnode[0] = 0;
		nextnode[1] = 0;
		edge[0] = 0;
		edge[1] = 0;
		for(int i=1;i<n+1;i++){
			node[i] = scan.nextLong();
		}
		for(int i=2;i<n+1;i++){
			nextnode[i] = scan.nextLong();
			edge[i] = scan.nextLong();
		}

		while(true){
			int i = getIndex(nextnode,1,n);
			//System.out.println(i);
			if(i==-1)
				break;
			long dist = 0;
			int t = i;
			dist = edge[i];
			while(true){
				int temp = getIndex(nextnode,t,n);
					//System.out.println(temp);
				if(temp!=-1)
				{
					t = temp;
					dist = dist + edge[t];
				}
				else
					break;
			}
			nextnode[t] = 0;
			if(dist>node[t]){
				count++;
			}

		}
		System.out.println(count);
	}

	private static int getIndex(long[] nextnode, int k,int n) {
		for(int i=2;i<n+1;i++){
			if(nextnode[i]==k)
				return i;
		}
		return -1;
	}
}


import java.util.Scanner;
import java.util.HashMap;

public class Tester {
	static Node[] node;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		node = new Node[n];

		for(int i=0;i<n;i++){
			node[i] = new Node(scan.nextLong());
		}
		for(int i=0;i<n-1;i++){
			int t = scan.nextInt();
			node[t-1].edge.put(i+1,scan.nextLong());
		}
		df(node[0]);
		System.out.println(f(node[0],0));
	}

	private static int f(Node n, long t) {
		int c = 0;
		if(t>n.a)
			return n.c;
		for(int i:n.edge.keySet()){
			long total = t + n.edge.get(i);
			if(total>0)
			c = c + f(node[i],total);
			else
			c = c + f(node[i],0);
		}
		return c;
	}

	public static void df(Node n){
		int c = 1;
		for(int i:n.edge.keySet()){
			df(node[i]);
			c += node[i].c;
		}
		n.c = c;
	}
	public static class Node {
	long a=0;
	HashMap<Integer,Long> edge = new HashMap<Integer,Long>();
	int c=0;

	public Node(long a){
		this.a = a;
	}
}

}


import java.util.Scanner;
import java.util.HashMap;

public class Tester {
	static Node[] node;
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		node = new Node[n];

		for(int i=0;i<n;i++){
			node[i] = new Node(scan.nextLong());
		}
		for(int i=0;i<n-1;i++){
			int t = scan.nextInt();
			node[t-1].edge.put(i+1,scan.nextLong());
		}
		df(node[0]);
		System.out.println(f(node[0],0));
	}

	private static int f(Node n, long t) {
		int c = 0;
		if(t>n.a)
			return n.c;
		for(int i:n.edge.keySet()){
			long total = t + n.edge.get(i);
			c = c + f(node[i],total);
		}
		return c;
	}

	public static void df(Node n){
		int c = 1;
		for(int i:n.edge.keySet()){
			df(node[i]);
			c += node[i].c;
		}
		n.c = c;
	}
	public static class Node {
	long a=0;
	HashMap<Integer,Long> edge = new HashMap<Integer,Long>();
	int c=0;

	public Node(long a){
		this.a = a;
	}
}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.TreeMap;

/**
 * Hello world!
 *
 */
public class App {
    private static List<List<Integer>> tree;
    private static int[] degree;
    private static Map<Long, Long> edges = new HashMap<>();
    private static long[] weight;
    private static long cnt = 0;
    public static void main(String[] args) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            String[] line;
            line = reader.readLine().split(" ");
            int n = Integer.parseInt(line[0]);
            tree = new ArrayList<>(n + 1);
            degree = new int[n + 1];
            weight = new long[n + 1];
            for (int i = 0; i < n + 1; ++i) {
                tree.add(new ArrayList<>());
            }
            line = reader.readLine().split(" ");
            for (int i = 0; i < line.length; ++i) {
                weight[i + 1] = Integer.parseInt(line[i]);
            }
            for (int i = 0; i < n - 1; ++i) {
                line = reader.readLine().split(" ");
                int u = i + 2;
                int v = Integer.parseInt(line[0]);
                long c = Integer.parseInt(line[1]);
                tree.get(u).add(v);
                tree.get(v).add(u);
                edges.put((long)u << 32 | v, c);
                edges.put((long)v << 32 | u, c);
                degree[u]++;
                degree[v]++;
            }
            tree.get(1).add(0);
            dfs(1, 0, 0);
            System.out.println(cnt);
        }
    }

    private static void dfs(int curr, int parent, long pathSum) {
        pathSum += edges.getOrDefault((long) curr << 32 | parent, 0l);
        pathSum = Math.max(0, pathSum);
        for (int child : tree.get(curr)) {
            if (child != parent) {
                dfs(child, curr, pathSum);
            }
        }
        if (degree[curr] <= 1 && weight[curr] < pathSum) {
            cnt++;
            --degree[parent];
            --degree[curr];
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.TreeMap;

/**
 * Hello world!
 *
 */
public class App {
    private static List<List<Integer>> tree;
    private static int[] degree;
    private static Map<Long, Long> edges = new HashMap<>();
    private static long[] weight;
    private static long cnt = 0;
    public static void main(String[] args) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            String[] line;
            line = reader.readLine().split(" ");
            int n = Integer.parseInt(line[0]);
            tree = new ArrayList<>(n + 1);
            degree = new int[n + 1];
            weight = new long[n + 1];
            for (int i = 0; i < n + 1; ++i) {
                tree.add(new ArrayList<>());
            }
            line = reader.readLine().split(" ");
            for (int i = 0; i < line.length; ++i) {
                weight[i + 1] = Integer.parseInt(line[i]);
            }
            for (int i = 0; i < n - 1; ++i) {
                line = reader.readLine().split(" ");
                int u = i + 2;
                int v = Integer.parseInt(line[0]);
                long c = Integer.parseInt(line[1]);
                tree.get(u).add(v);
                tree.get(v).add(u);
                edges.put((long)u << 32 | v, c);
                edges.put((long)v << 32 | u, c);
                degree[u]++;
                degree[v]++;
            }
            tree.get(1).add(0);
            dfs(1, 0, 0, false);
            System.out.println(cnt);
        }
    }

    private static void dfs(int curr, int parent, long pathSum, boolean delete) {
        pathSum += edges.getOrDefault((long) curr << 32 | parent, 0l);
        pathSum = Math.max(0, pathSum);
        delete = delete || weight[curr] < pathSum;
        for (int child : tree.get(curr)) {
            if (child != parent) {
                dfs(child, curr, pathSum, delete);
            }
        }
        if (delete) {
            cnt++;
            --degree[parent];
            --degree[curr];
        }
    }
}


import java.util.*;
import java.io.*;
//import java.lang.*;

public class ranjan{

    public static Read cin;
    public static PrintWriter cout;
    public static boolean[] visited;
    public static final long b = (long)1e9+7;
    public static int fileread = 0;

    public static void main(String ...arg) throws IOException
    {
        /*console writer*/
        cout = new PrintWriter(new BufferedOutputStream(System.out));
        /*Debug Reader*/
        //Scan cin =new Scan();
        if(fileread == 1)
        {
            try
            {
            cin = new Read(new FileInputStream(new File("in2.txt")));
            //cin = new InputReader(new FileInputStream(new File("in3.txt")));
            }
            catch (IOException error){}
        }
        else{
            cin = new Read(System.in);
            //cin = new InputReader(System.in);
        }

        int n = cin.nextInt();
        int[] a = new int[n+1];
        for(int i=1;i<=n;i++)
            a[i] = cin.nextInt();
        ArrayList<Integer>[] tree = new ArrayList[n+1];
        ArrayList<Integer>[] weight = new ArrayList[n+1];
        visited = new boolean[n+1];
        for(int i=0;i<=n;i++)
        {
            tree[i] = new ArrayList<Integer>();
            weight[i] = new ArrayList<Integer>();
        }

        for(int i=2;i<=n;i++)
        {
            int x = cin.nextInt();
            int y = cin.nextInt();
            tree[i].add(x);
            tree[x].add(i);
            weight[x].add(y);
            weight[i].add(y);
        }
        //cout.print(Arrays.toString(tree)+"\n");
        //cout.print(Arrays.toString(weight)+"\n");
        cout.print(dfs(tree,weight,1,0,a));
        cout.close();
    }
    public static int nodeCounter(ArrayList<Integer>[] tree,ArrayList<Integer>[] weight,int parent)
    {
        visited[parent] = true;
        int ans = 1;
        for(int i=0;i<tree[parent].size();i++)
        {
            int child = (int)tree[parent].get(i);
            if(!visited[child])
            {
                ans += nodeCounter(tree,weight,child);
            }
        }
        return ans;
    }

    public static int dfs(ArrayList<Integer>[] tree,ArrayList<Integer>[] weight,int parent,int cost,int[] a)
    {
        visited[parent] = true;
        int ans = 0;
        for(int i=0;i<tree[parent].size();i++)
        {
            int child = (int)tree[parent].get(i);

            if(!visited[child])
            {
                int pathCost = weight[parent].get(i);
                if(cost+pathCost > a[child])
                {
                    ans += nodeCounter(tree,weight,child);
                }
                else
                    ans += dfs(tree,weight,child,cost+pathCost,a);
            }
        }
        return ans;
    }

    public static long mod_pow(long x,long n,long mod) {
		long res=1;
		while(n>0) {
			if((n&1)==1)res=res*x%mod;
			x=x*x%mod;
			n>>=1;
		}
		return res;
	}

    static class InputReader {
        final InputStream is;
        final byte[] buf = new byte[1024];
        int pos;
        int size;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sign;
        }

        int read() {
            if (size == -1)
                throw new InputMismatchException();
            if (pos >= size) {
                pos = 0;
                try {
                    size = is.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0)
                    return -1;
            }
            return buf[pos++] & 255;
        }

        static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

static class RecursionLimiter {
    public static long maxLevel = 1549;

    public static void emerge() {
        if (maxLevel == 0)
            return;
        try {
            throw new IllegalStateException("Too deep, emerging");
        } catch (IllegalStateException e) {
            if (e.getStackTrace().length > maxLevel + 1)
                throw e;
        }
    }
}

static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }

}

class Read
{
    private BufferedReader br;
    private StringTokenizer st;

    public Read(InputStream is)
    { br = new BufferedReader(new InputStreamReader(is)); }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try {st = new StringTokenizer(br.readLine());}
            catch(IOException e)
                {e.printStackTrace();}
        }
        return st.nextToken();
    }

    int nextInt()
    { return Integer.parseInt(next()); }

    long nextLong()
    { return Long.parseLong(next()); }

    double nextDouble()
    { return Double.parseDouble(next()); }

    String nextLine()
    {
        String str = "";
        try {str = br.readLine();}
        catch(IOException e)
            {e.printStackTrace();}
        return str;
    }
}


import java.util.*;
import java.io.*;
//import java.lang.*;

public class ranjan{

    public static Read cin;
    public static PrintWriter cout;
    public static boolean[] visited;
    public static final long b = (long)1e9+7;
    public static int fileread = 0;

    public static void main(String ...arg) throws IOException
    {
        /*console writer*/
        cout = new PrintWriter(new BufferedOutputStream(System.out));
        /*Debug Reader*/
        //Scan cin =new Scan();
        if(fileread == 1)
        {
            try
            {
            cin = new Read(new FileInputStream(new File("in3.txt")));
            //cin = new InputReader(new FileInputStream(new File("in3.txt")));
            }
            catch (IOException error){}
        }
        else{
            cin = new Read(System.in);
            //cin = new InputReader(System.in);
        }

        int n = cin.nextInt();
        int[] a = new int[n+1];
        for(int i=1;i<=n;i++)
            a[i] = cin.nextInt();
        ArrayList<Integer>[] tree = new ArrayList[n+1];
        ArrayList<Integer>[] weight = new ArrayList[n+1];
        visited = new boolean[n+1];
        for(int i=0;i<=n;i++)
        {
            tree[i] = new ArrayList<Integer>();
            weight[i] = new ArrayList<Integer>();
        }

        for(int i=2;i<=n;i++)
        {
            int x = cin.nextInt();
            int y = cin.nextInt();
            tree[i].add(x);
            tree[x].add(i);
            weight[x].add(y);
            weight[i].add(y);
        }
        //cout.print(Arrays.toString(tree)+"\n");
        //cout.print(Arrays.toString(weight)+"\n");
        cout.print(dfs(tree,weight,1,(int)-1e9,a));
        cout.close();
    }
    public static int nodeCounter(ArrayList<Integer>[] tree,ArrayList<Integer>[] weight,int parent)
    {
        visited[parent] = true;
        int ans = 1;
        for(int i=0;i<tree[parent].size();i++)
        {
            int child = (int)tree[parent].get(i);
            if(!visited[child])
            {
                ans += nodeCounter(tree,weight,child);
            }
        }
        return ans;
    }

    public static int dfs(ArrayList<Integer>[] tree,ArrayList<Integer>[] weight,int parent,int cost,int[] a)
    {
        visited[parent] = true;
        int ans = 0;
        if(a[parent] < cost)
        {
            ans += nodeCounter(tree,weight,parent);
            return ans;
        }
        for(int i=0;i<tree[parent].size();i++)
        {
            int child = (int)tree[parent].get(i);
            if(!visited[child])
            {
                int pathCost = weight[parent].get(i);
                ans += dfs(tree,weight,child,Math.max(cost+pathCost,pathCost),a);
            }
        }
        return ans;
    }

    public static long mod_pow(long x,long n,long mod) {
		long res=1;
		while(n>0) {
			if((n&1)==1)res=res*x%mod;
			x=x*x%mod;
			n>>=1;
		}
		return res;
	}

    static class InputReader {
        final InputStream is;
        final byte[] buf = new byte[1024];
        int pos;
        int size;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sign;
        }

        int read() {
            if (size == -1)
                throw new InputMismatchException();
            if (pos >= size) {
                pos = 0;
                try {
                    size = is.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0)
                    return -1;
            }
            return buf[pos++] & 255;
        }

        static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

static class RecursionLimiter {
    public static long maxLevel = 1549;

    public static void emerge() {
        if (maxLevel == 0)
            return;
        try {
            throw new IllegalStateException("Too deep, emerging");
        } catch (IllegalStateException e) {
            if (e.getStackTrace().length > maxLevel + 1)
                throw e;
        }
    }
}

static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }

}

class Read
{
    private BufferedReader br;
    private StringTokenizer st;

    public Read(InputStream is)
    { br = new BufferedReader(new InputStreamReader(is)); }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try {st = new StringTokenizer(br.readLine());}
            catch(IOException e)
                {e.printStackTrace();}
        }
        return st.nextToken();
    }

    int nextInt()
    { return Integer.parseInt(next()); }

    long nextLong()
    { return Long.parseLong(next()); }

    double nextDouble()
    { return Double.parseDouble(next()); }

    String nextLine()
    {
        String str = "";
        try {str = br.readLine();}
        catch(IOException e)
            {e.printStackTrace();}
        return str;
    }
}


import java.util.*;
import java.io.*;
//import java.lang.*;

public class ranjan{

    //public static Read cin;
    public static InputReader cin;
    public static PrintWriter cout;
    public static boolean[] visited;
    public static final long b = (long)1e9+7;
    public static int fileread = 0;

    public static void main(String ...arg) throws IOException
    {
        /*console writer*/
        cout = new PrintWriter(new BufferedOutputStream(System.out));
        /*Debug Reader*/
        //Scan cin =new Scan();
        if(fileread == 1)
        {
            try
            {
            //cin = new Read(new FileInputStream(new File("in3.txt")));
            cin = new InputReader(new FileInputStream(new File("in3.txt")));
            }
            catch (IOException error){}
        }
        else{
            //cin = new Read(System.in);
            cin = new InputReader(System.in);
        }

        int n = cin.nextInt();
        int[] a = new int[n+1];
        for(int i=1;i<=n;i++)
            a[i] = cin.nextInt();
        ArrayList<Integer>[] tree = new ArrayList[n+1];
        ArrayList<Integer>[] weight = new ArrayList[n+1];
        visited = new boolean[n+1];
        for(int i=0;i<=n;i++)
        {
            tree[i] = new ArrayList<Integer>();
            weight[i] = new ArrayList<Integer>();
        }

        for(int i=2;i<=n;i++)
        {
            int x = cin.nextInt();
            int y = cin.nextInt();
            tree[i].add(x);
            tree[x].add(i);
            weight[x].add(y);
            weight[i].add(y);
        }
        //cout.print(Arrays.toString(tree)+"\n");
        //cout.print(Arrays.toString(weight)+"\n");
        cout.print(dfs(tree,weight,1,(int)-1e9,a));
        cout.close();
    }
    public static int nodeCounter(ArrayList<Integer>[] tree,ArrayList<Integer>[] weight,int parent)
    {
        visited[parent] = true;
        int ans = 1;
        for(int i=0;i<tree[parent].size();i++)
        {
            int child = (int)tree[parent].get(i);
            if(!visited[child])
            {
                ans += nodeCounter(tree,weight,child);
            }
        }
        return ans;
    }

    public static int dfs(ArrayList<Integer>[] tree,ArrayList<Integer>[] weight,int parent,int cost,int[] a)
    {
        visited[parent] = true;
        int ans = 0;
        if(a[parent] < cost)
        {
            ans += nodeCounter(tree,weight,parent);
            return ans;
        }
        for(int i=0;i<tree[parent].size();i++)
        {
            int child = (int)tree[parent].get(i);
            if(!visited[child])
            {
                int pathCost = weight[parent].get(i);
                ans += dfs(tree,weight,child,Math.max(cost+pathCost,pathCost),a);
            }
        }
        return ans;
    }

    public static long mod_pow(long x,long n,long mod) {
		long res=1;
		while(n>0) {
			if((n&1)==1)res=res*x%mod;
			x=x*x%mod;
			n>>=1;
		}
		return res;
	}

    static class InputReader {
        final InputStream is;
        final byte[] buf = new byte[1024];
        int pos;
        int size;

        public InputReader(InputStream is) {
            this.is = is;
        }

        public int nextInt() {
            int c = read();
            while (isWhitespace(c))
                c = read();
            int sign = 1;
            if (c == '-') {
                sign = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res = res * 10 + c - '0';
                c = read();
            } while (!isWhitespace(c));
            return res * sign;
        }

        int read() {
            if (size == -1)
                throw new InputMismatchException();
            if (pos >= size) {
                pos = 0;
                try {
                    size = is.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0)
                    return -1;
            }
            return buf[pos++] & 255;
        }

        static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

static class RecursionLimiter {
    public static long maxLevel = 1549;

    public static void emerge() {
        if (maxLevel == 0)
            return;
        try {
            throw new IllegalStateException("Too deep, emerging");
        } catch (IllegalStateException e) {
            if (e.getStackTrace().length > maxLevel + 1)
                throw e;
        }
    }
}

static class Scan {
        private byte[] buf=new byte[1024];
        private int index;
        private InputStream in;
        private int total;
        public Scan()
        {
            in=System.in;
        }
        public int scan()throws IOException
        {
            if(total<0)
            throw new InputMismatchException();
            if(index>=total)
            {
                index=0;
                total=in.read(buf);
                if(total<=0)
                return -1;
            }
            return buf[index++];
        }
        public int scanInt()throws IOException
        {
            int integer=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    integer*=10;
                    integer+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            return neg*integer;
        }
        public double scanDouble()throws IOException
        {
            double doub=0;
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            int neg=1;
            if(n=='-')
            {
                neg=-1;
                n=scan();
            }
            while(!isWhiteSpace(n)&&n!='.')
            {
                if(n>='0'&&n<='9')
                {
                    doub*=10;
                    doub+=n-'0';
                    n=scan();
                }
                else throw new InputMismatchException();
            }
            if(n=='.')
            {
                n=scan();
                double temp=1;
                while(!isWhiteSpace(n))
                {
                    if(n>='0'&&n<='9')
                    {
                        temp/=10;
                        doub+=(n-'0')*temp;
                        n=scan();
                    }
                    else throw new InputMismatchException();
                }
            }
            return doub*neg;
        }
        public String scanString()throws IOException
        {
            StringBuilder sb=new StringBuilder();
            int n=scan();
            while(isWhiteSpace(n))
            n=scan();
            while(!isWhiteSpace(n))
            {
                sb.append((char)n);
                n=scan();
            }
            return sb.toString();
        }
        private boolean isWhiteSpace(int n)
        {
            if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
            return true;
            return false;
        }
    }

}

class Read
{
    private BufferedReader br;
    private StringTokenizer st;

    public Read(InputStream is)
    { br = new BufferedReader(new InputStreamReader(is)); }

    String next()
    {
        while (st == null || !st.hasMoreElements())
        {
            try {st = new StringTokenizer(br.readLine());}
            catch(IOException e)
                {e.printStackTrace();}
        }
        return st.nextToken();
    }

    int nextInt()
    { return Integer.parseInt(next()); }

    long nextLong()
    { return Long.parseLong(next()); }

    double nextDouble()
    { return Double.parseDouble(next()); }

    String nextLine()
    {
        String str = "";
        try {str = br.readLine();}
        catch(IOException e)
            {e.printStackTrace();}
        return str;
    }
}


import java.util.*;
import java.io.*;

public class gfg  {

    public static void main(String[] args) throws IOException{
        //Reader.init(System.in);
        //PrintWriter out = new PrintWriter(System.out);
        Reader.init(System.in);
        int t = 1;//Reader.nextInt();
        while(t-->0){
           solve();
        }
            //out.close();
    }

    static ArrayList<int[]>[] graph;
    //static ArrayList<Integer>[] set;
    static int n=0;
    static int m=0;
    static boolean[][] vis;
    //static char[][] arr;
    static long mod =1000000007;
    static int min=-1;
    //static ArrayList<int[]> list ;
    static int[] s;
    static int[] a;
    static boolean invalid=false;
    static int[] dx = {0,0,-1,1};
    static int[] dy = {1,-1,0,0};
    static int count=0;
    static int edges=0;
    static char[][] arr;
    static boolean[][] reached;
    static int[] v;

    static void solve()throws IOException{
        n =Reader.nextInt();
        graph = new ArrayList[n+1];
        for(int i=1;i<=n;i++)
            graph[i] = new ArrayList<int[]>();

        v = new int[n+1];
        for(int i=1;i<=n;i++){
            v[i]  = Reader.nextInt();
        }
        for(int i=1;i<=n-1;i++){
            int a = Reader.nextInt();
            int c = Reader.nextInt();
            int[] arr1 = {a,c};
            int[] arr2 = {i+1,c};
            graph[i+1].add(arr1);
            graph[a].add(arr2);
        }
        count=1;
        dfs(1,-1,0);
        System.out.println(n-count);
    }

    static void dfs(int a,int p, int path){ // u[ar = false means upar edge h;
        for(int[] arr: graph[a]){
            int b = arr[0];
            int c = arr[1];
            int temp = path+c;
            if(b!=p){
                if(temp<=v[b]){
                    count++;
                    dfs(b,a,temp);
                }
            }
        }
    }

    // ggratest common divisor
    static int gcd(int a , int b){
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    // least common multiple
    static int lcm(int a, int b){
        return (a*b)/gcd(a,b);
    }

    // a^b
    static long fastpow(long a, long b){
        long res = 1;a=a%mod;
        while(b>0){
            if(b%2==1)
                res = (res*a)%mod;
            a = (a*a)%mod;
            b = b>>1;
        }
        return res;
    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}
class newcomparator implements Comparator<Integer>{
    //@Override
    public int compare(Integer a, Integer  b){
        return a<=b?1:-1;
    }
 }
class node {
    int a;
    long b;// cost to rreach\
    node(int s,long va){
        a=s;
        b=va;
    }
}
class mergesort{
    static void sort(int l, int h, int[] arr){
        if(l<h){
            int mid = (l+h)/2;

            sort(l,mid,arr);
            sort(mid+1,h,arr);
            merge(l,mid,h,arr);
        }
    }
    static void merge(int l, int m , int h , int [] arr){

        int[] left = new int[m-l+1];
        int[] right = new int[h-m];
        for(int i= 0 ;i< m-l+1;i++){
            left[i] = arr[l+i];
        }
        for(int i=0;i<h-m;i++){
            right[i] = arr[m+1+i];
        }
        //now left and right arrays are assumed to be sorted and we have tp merge them together
        // int the original aaray.
        int i=l;
        int lindex = 0;
        int rindex =  0;

        while(lindex<m-l+1 && rindex<h-m){
            if(left[lindex]<=right[rindex]){
                arr[i]=left[lindex];
                lindex++;
                i++;
            }
            else{
                arr[i]=right[rindex];
                rindex++;
                i++;
            }
        }
        while(lindex<m-l+1){
            arr[i]=left[lindex];
            lindex++;
            i++;
        }
        while(rindex<h-m){
            arr[i]=right[rindex];
            rindex++;
            i++;
        }
    }

}


import java.util.*;
import java.io.*;

public class gfg  {

    public static void main(String[] args) throws IOException{
        //Reader.init(System.in);
        //PrintWriter out = new PrintWriter(System.out);
        Reader.init(System.in);
        int t = 1;//Reader.nextInt();
        while(t-->0){
           solve();
        }
            //out.close();
    }

    static ArrayList<int[]>[] graph;
    //static ArrayList<Integer>[] set;
    static int n=0;
    static int m=0;
    static boolean[][] vis;
    //static char[][] arr;
    static long mod =1000000007;
    static int min=-1;
    //static ArrayList<int[]> list ;
    static int[] s;
    static int[] a;
    static boolean invalid=false;
    static int[] dx = {0,0,-1,1};
    static int[] dy = {1,-1,0,0};
    static int count=0;
    static int edges=0;
    static char[][] arr;
    static boolean[][] reached;
    static int[] v;

    static void solve()throws IOException{
        n =Reader.nextInt();
        graph = new ArrayList[n+1];
        for(int i=1;i<=n;i++)
            graph[i] = new ArrayList<int[]>();

        v = new int[n+1];
        for(int i=1;i<=n;i++){
            v[i]  = Reader.nextInt();
        }
        for(int i=1;i<=n-1;i++){
            int a = Reader.nextInt();
            int c = Reader.nextInt();
            int[] arr1 = {a,c};
            int[] arr2 = {i+1,c};
            graph[i+1].add(arr1);
            graph[a].add(arr2);
        }
        count=1;
        dfs(1,-1,0,1000000003);
        System.out.println(n-count);
    }

    static void dfs(int a,int p, long path,long min){ // u[ar = false means upar edge h;
        for(int[] arr: graph[a]){
            int b = arr[0];
            int c = arr[1];
            long temp = path+c;
            if(b!=p){
                min = Math.min(path,min);
                if(temp-min<=v[b]){
                    count++;
                    dfs(b,a,temp,min);
                }
            }
        }
    }

    // ggratest common divisor
    static int gcd(int a , int b){
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    // least common multiple
    static int lcm(int a, int b){
        return (a*b)/gcd(a,b);
    }

    // a^b
    static long fastpow(long a, long b){
        long res = 1;a=a%mod;
        while(b>0){
            if(b%2==1)
                res = (res*a)%mod;
            a = (a*a)%mod;
            b = b>>1;
        }
        return res;
    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}
class newcomparator implements Comparator<Integer>{
    //@Override
    public int compare(Integer a, Integer  b){
        return a<=b?1:-1;
    }
 }
class node {
    int a;
    long b;// cost to rreach\
    node(int s,long va){
        a=s;
        b=va;
    }
}
class mergesort{
    static void sort(int l, int h, int[] arr){
        if(l<h){
            int mid = (l+h)/2;

            sort(l,mid,arr);
            sort(mid+1,h,arr);
            merge(l,mid,h,arr);
        }
    }
    static void merge(int l, int m , int h , int [] arr){

        int[] left = new int[m-l+1];
        int[] right = new int[h-m];
        for(int i= 0 ;i< m-l+1;i++){
            left[i] = arr[l+i];
        }
        for(int i=0;i<h-m;i++){
            right[i] = arr[m+1+i];
        }
        //now left and right arrays are assumed to be sorted and we have tp merge them together
        // int the original aaray.
        int i=l;
        int lindex = 0;
        int rindex =  0;

        while(lindex<m-l+1 && rindex<h-m){
            if(left[lindex]<=right[rindex]){
                arr[i]=left[lindex];
                lindex++;
                i++;
            }
            else{
                arr[i]=right[rindex];
                rindex++;
                i++;
            }
        }
        while(lindex<m-l+1){
            arr[i]=left[lindex];
            lindex++;
            i++;
        }
        while(rindex<h-m){
            arr[i]=right[rindex];
            rindex++;
            i++;
        }
    }

}


import java.util.*;
import java.io.*;

public class gfg  {

    public static void main(String[] args) throws IOException{
        //Reader.init(System.in);
        //PrintWriter out = new PrintWriter(System.out);
        Reader.init(System.in);
        int t = 1;//Reader.nextInt();
        while(t-->0){
           solve();
        }
            //out.close();
    }

    static ArrayList<int[]>[] graph;
    //static ArrayList<Integer>[] set;
    static int n=0;
    static int m=0;
    static boolean[][] vis;
    //static char[][] arr;
    static long mod =1000000007;
    static int min=-1;
    //static ArrayList<int[]> list ;
    static int[] s;
    static int[] a;
    static boolean invalid=false;
    static int[] dx = {0,0,-1,1};
    static int[] dy = {1,-1,0,0};
    static int count=0;
    static int edges=0;
    static char[][] arr;
    static boolean[][] reached;
    static int[] v;

    static void solve()throws IOException{
        n =Reader.nextInt();
        graph = new ArrayList[n+1];
        for(int i=1;i<=n;i++)
            graph[i] = new ArrayList<int[]>();

        v = new int[n+1];
        for(int i=1;i<=n;i++){
            v[i]  = Reader.nextInt();
        }
        for(int i=1;i<=n-1;i++){
            int a = Reader.nextInt();
            int c = Reader.nextInt();
            int[] arr1 = {a,c};
            int[] arr2 = {i+1,c};
            graph[i+1].add(arr1);
            graph[a].add(arr2);
        }
        count=1;
        dfs(1,-1,0,1000000003);
        System.out.println(n-count);
    }

    static void dfs(int a,int p, int path,int min){ // u[ar = false means upar edge h;
        for(int[] arr: graph[a]){
            int b = arr[0];
            int c = arr[1];
            int temp = path+c;
            if(b!=p){
                min = Math.min(path,min);
                if(temp-min<=v[b]){
                    count++;
                    dfs(b,a,temp,min);
                }
            }
        }
    }

    // ggratest common divisor
    static int gcd(int a , int b){
        if(b==0)
            return a;
        else
            return gcd(b,a%b);
    }

    // least common multiple
    static int lcm(int a, int b){
        return (a*b)/gcd(a,b);
    }

    // a^b
    static long fastpow(long a, long b){
        long res = 1;a=a%mod;
        while(b>0){
            if(b%2==1)
                res = (res*a)%mod;
            a = (a*a)%mod;
            b = b>>1;
        }
        return res;
    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}
class newcomparator implements Comparator<Integer>{
    //@Override
    public int compare(Integer a, Integer  b){
        return a<=b?1:-1;
    }
 }
class node {
    int a;
    long b;// cost to rreach\
    node(int s,long va){
        a=s;
        b=va;
    }
}
class mergesort{
    static void sort(int l, int h, int[] arr){
        if(l<h){
            int mid = (l+h)/2;

            sort(l,mid,arr);
            sort(mid+1,h,arr);
            merge(l,mid,h,arr);
        }
    }
    static void merge(int l, int m , int h , int [] arr){

        int[] left = new int[m-l+1];
        int[] right = new int[h-m];
        for(int i= 0 ;i< m-l+1;i++){
            left[i] = arr[l+i];
        }
        for(int i=0;i<h-m;i++){
            right[i] = arr[m+1+i];
        }
        //now left and right arrays are assumed to be sorted and we have tp merge them together
        // int the original aaray.
        int i=l;
        int lindex = 0;
        int rindex =  0;

        while(lindex<m-l+1 && rindex<h-m){
            if(left[lindex]<=right[rindex]){
                arr[i]=left[lindex];
                lindex++;
                i++;
            }
            else{
                arr[i]=right[rindex];
                rindex++;
                i++;
            }
        }
        while(lindex<m-l+1){
            arr[i]=left[lindex];
            lindex++;
            i++;
        }
        while(rindex<h-m){
            arr[i]=right[rindex];
            rindex++;
            i++;
        }
    }

}


import java.util.*;
import java.io.*;
public class pt{

      static class Edge{

             int s,d,w;

                 Edge(int S,int D,int W)
                      { s=S ; d = D; w = W;}
        }
      static void dfs(LinkedList<Edge> l[],int s,int p,int sz[]){

                           for(Edge e : l[s])
                               if(e.d!=p){
                                  dfs(l,e.d,s,sz);
                                  sz[s] = sz[s]+sz[e.d];
                               }
                   }
       static int ans=0;
       static void dfs1(LinkedList<Edge> l[],int s,int p,int a[],int sz[],long dist){

                              for(Edge e : l[s])
                                  if(e.d!=p){
                                      if(Math.max((dist+e.w),e.w)>a[e.d])
                                         ans = ans+sz[e.d];
                                      else
                                             dfs1(l,e.d,s,a,sz,Math.max((dist+e.w),e.w));
                                 }

                   }
      public static void main(String[] args)throws IOException {
                      PrintWriter out = new PrintWriter(System.out);

                        int n = ni();
                        int a[] = new int[n];
                        LinkedList<Edge> l[] = new LinkedList[n];
                        int sz[] = new int[n];
                    for(int i=0;i<n;i++)
                         a[i] = ni();

                    for(int i=0;i<n;i++)
                        l[i] = new LinkedList();
                    Arrays.fill(sz,1);

                    for(int i=1;i<n;i++){
                        int v = ni()-1;
                        int c = ni();
                        Edge e1 = new Edge(i,v,c);
                        Edge e2 = new Edge(v,i,c);
                        l[i].add(e1);
                        l[v].add(e2);
                    }
                           dfs(l,0,-1,sz);
                           dfs1(l,0,-1,a,sz,0);
                               out.println(ans);
                               out.flush();

    }
    static FastReader sc=new FastReader();

      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
import java.io.*;
public class pt{

      static class Edge{

             int s,d,w;

                 Edge(int S,int D,int W)
                      { s=S ; d = D; w = W;}
        }
      static void dfs(LinkedList<Edge> l[],int s,int p,int sz[]){

                           for(Edge e : l[s])
                               if(e.d!=p){
                                  dfs(l,e.d,s,sz);
                                  sz[s] = sz[s]+sz[e.d];
                               }
                   }
       static int ans=0;
       static void dfs1(LinkedList<Edge> l[],int s,int p,int a[],int sz[],long dist){

                              for(Edge e : l[s])
                                  if(e.d!=p){
                                      if((dist+e.w)>a[e.d])
                                         ans = ans+sz[e.d];
                                      else
                                             dfs1(l,e.d,s,a,sz,dist+e.w);
                                 }

                   }
      public static void main(String[] args)throws IOException {
                      PrintWriter out = new PrintWriter(System.out);

                        int n = ni();
                        int a[] = new int[n];
                        LinkedList<Edge> l[] = new LinkedList[n];
                        int sz[] = new int[n];
                    for(int i=0;i<n;i++)
                         a[i] = ni();

                    for(int i=0;i<n;i++)
                        l[i] = new LinkedList();
                    Arrays.fill(sz,1);

                    for(int i=1;i<n;i++){
                        int v = ni()-1;
                        int c = ni();
                        Edge e1 = new Edge(i,v,c);
                        Edge e2 = new Edge(v,i,c);
                        l[i].add(e1);
                        l[v].add(e2);
                    }
                           dfs(l,0,-1,sz);
                           dfs1(l,0,-1,a,sz,0);
                               out.println(ans);
                               out.flush();

    }
    static FastReader sc=new FastReader();

      static int ni(){
                 int x = sc.nextInt();
                 return(x);
        }
      static long nl(){
              long x = sc.nextLong();
              return(x);
         }
      static String n(){
                 String str = sc.next();
                     return(str);
       }
     static String ns(){
                 String str = sc.nextLine();
                   return(str);
      }
     static double nd(){
               double d = sc.nextDouble();
                 return(d);
       }
  static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}