import java.io.IOException;
import java.util.HashMap;
import java.util.InputMismatchException;

public class AlyonaAndTheTree {
    public static void main(String[] args) {
        FasterScanner sc = new FasterScanner();

        int N = sc.nextInt();

        Node[] nodes = new Node[N + 1];
        for (int i = 1; i <= N; i++) {
        	int A = sc.nextInt();
        	nodes[i] = new Node(i, A);
        }

        for (int i = 2; i <= N; i++) {
        	int P = sc.nextInt();
        	long C = sc.nextLong();
        	nodes[i].next.put(nodes[P], C);
        	nodes[P].next.put(nodes[i], C);
        }

        boolean[] used = new boolean[N + 1];
        boolean[] dead = new boolean[N + 1];

        allow(nodes[1], 0, used, dead);

        int cnt = 0;
        for (int i = 1; i <= N; i++) {
        	if (dead[i]) {
        		cnt++;
        	}
        }
        System.out.println(cnt);
    }

    private static void allow(Node n, long dist, boolean[] used, boolean[] dead) {
    	used[n.idx] = true;
    	dist = Math.max(dist, 0);
    	for (Node v : n.next.keySet()) {
    		if (!used[v.idx]) {
	    		long d = n.next.get(v) + dist;
	    		if (d > v.num) {
	    			nuke(v, used, dead);
	    		} else {
	    			allow(v, d, used, dead);
	    		}
    		}
    	}
    }

    private static void nuke(Node n, boolean[] used, boolean[] dead) {
    	used[n.idx] = true;
    	dead[n.idx] = true;
    	for (Node v : n.next.keySet()) {
    		if (!used[v.idx]) {
    			nuke(v, used, dead);
    		}
    	}
    }

    public static class Node {
    	public int idx;
    	public int num;
    	public HashMap<Node, Long> next;

    	public Node(int i, int n) {
    		this.idx = i;
    		this.num = n;
    		this.next = new HashMap<Node, Long>();
    	}
    }

	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

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

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long 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 int nextInt() {
			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 int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

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

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

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

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

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}


import java.io.IOException;
import java.util.HashMap;
import java.util.InputMismatchException;

public class AlyonaAndTheTree {
    public static void main(String[] args) {
        FasterScanner sc = new FasterScanner();

        int N = sc.nextInt();

        Node[] nodes = new Node[N + 1];
        for (int i = 1; i <= N; i++) {
        	int A = sc.nextInt();
        	nodes[i] = new Node(i, A);
        }

        for (int i = 2; i <= N; i++) {
        	int P = sc.nextInt();
        	long C = sc.nextLong();
        	nodes[i].next.put(nodes[P], C);
        	nodes[P].next.put(nodes[i], C);
        }

        boolean[] used = new boolean[N + 1];
        boolean[] dead = new boolean[N + 1];

        allow(nodes[1], 0, used, dead);

        int cnt = 0;
        for (int i = 1; i <= N; i++) {
        	if (dead[i]) {
        		cnt++;
        	}
        }
        System.out.println(cnt);
    }

    private static void allow(Node n, long dist, boolean[] used, boolean[] dead) {
    	used[n.idx] = true;
    	for (Node v : n.next.keySet()) {
    		if (!used[v.idx]) {
	    		long d = n.next.get(v) + dist;
	    		if (d > v.num) {
	    			nuke(v, used, dead);
	    		} else {
	    			allow(v, d, used, dead);
	    		}
    		}
    	}
    }

    private static void nuke(Node n, boolean[] used, boolean[] dead) {
    	used[n.idx] = true;
    	dead[n.idx] = true;
    	for (Node v : n.next.keySet()) {
    		if (!used[v.idx]) {
    			nuke(v, used, dead);
    		}
    	}
    }

    public static class Node {
    	public int idx;
    	public int num;
    	public HashMap<Node, Long> next;

    	public Node(int i, int n) {
    		this.idx = i;
    		this.num = n;
    		this.next = new HashMap<Node, Long>();
    	}
    }

	public static class FasterScanner {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

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

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}

		public String nextString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long 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 int nextInt() {
			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 int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}

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

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

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

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

		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main
{
static Stack<Integer> stack;
static int[][] adj;
static int[] size,weight_of_vertex,parent,visited;
static long[] dist,min;
static boolean[] removed_vertex;
static int n;
static Hashtable<Long,Integer> table;

public static void dfs(int source)
{
int time,val,j,edge_weight;
int number_of_nodes = n-1;
parent=new int[n];
int element = source;
int i = source;
long key;
//System.out.print(element + "\t");
visited[source] = 1;
stack.push(source);

parent[0]=-1;
min[0]=0L;
//height[source]=1;
//time=1;

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		stack.push(i);
		visited[i] = 1;
		parent[i]=element;

		key=element*1000000L+i;
		edge_weight=table.get(key);
		dist[i]=dist[element]+edge_weight;

		if(i!=0)
			min[i]=Math.min(min[element],dist[i]);

		element = i;
		j = 0;
		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void bfs(int source)
{
int i,j,element,size_q,x;

Arrays.fill(visited,0);
visited[source]=1;

int[] queue=new int[n];
i=0;
size_q=1;
queue[i]=source;

while(i<size_q)
{
element=queue[i];

for(j=0;j<size[element];j++)
	{

	x=adj[element][j];

	if (visited[x] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(x!=0)
		{
			if(removed_vertex[element])
				removed_vertex[x]=true;
		}

		visited[x]=1;

		queue[size_q++]=x;
		}
	}

i++;
}

}

public static void dfs1(int source)
{
int time,val,j;
int number_of_nodes = n-1;
int element = source;
int i = source;

Arrays.fill(visited,0);
visited[source] = 1;
stack.push(source);

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(i!=0)
		{
			if(removed_vertex[element])
				removed_vertex[i]=true;
		}

		stack.push(i);
		visited[i] = 1;
		element = i;
		j = 0;

		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void main(String[] args)throws java.lang.Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);

int i,x,y,edge_weight,cnt;
long key,path_weight,cur_min;

n=Integer.parseInt(in.readLine());

int[] weight_of_vertex =new int[n];
int[][] connected=new int[n-1][2];
adj=new int[n][];
size=new int[n];
visited= new int[n];
dist=new long[n];
min=new long[n];
removed_vertex=new boolean[n];
int[] cursize=new int[n];
stack = new Stack<Integer>();
table=new Hashtable<Long,Integer>();

StringTokenizer st=new StringTokenizer(in.readLine());

for(i=0;i<n;i++)
{
weight_of_vertex[i]=Integer.parseInt(st.nextToken());
}

for(i=0;i<n-1;i++)
{
StringTokenizer st1=new StringTokenizer(in.readLine().trim());

x=i+1;
y=Integer.parseInt(st1.nextToken().trim())-1;

connected[i][0]=x;
connected[i][1]=y;
edge_weight=Integer.parseInt(st1.nextToken().trim());

key=x*1000000L+y;
table.put(key,edge_weight);

key=y*1000000L+x;
table.put(key,edge_weight);

size[x]++;
size[y]++;
}

for(i=0;i<n;i++)
{
adj[i]=new int[size[i]];
}

for(i=0;i<n-1;i++)
{
x=connected[i][0];
y=connected[i][1];

adj[x][cursize[x]++]=y;
adj[y][cursize[y]++]=x;
}

dfs(0);

/*
for(i=0;i<n;i++)
{
	out.println(" "+dist[i]);
}

for(i=0;i<n;i++)
{
	out.println("->  "+min[i]);
}
*/

for(i=0;i<n;i++)
{
	if(i==0)
		cur_min=0L;
	else
		cur_min=min[parent[i]];

	path_weight=dist[i]-cur_min;
	if(path_weight>weight_of_vertex[i])
	{
		removed_vertex[i]=true;
		//out.println("*  "+(i+1));
	}
}

//stack.clear();

//dfs1(0);

bfs(0);

cnt=0;

for(i=0;i<n;i++)
{
	if(removed_vertex[i])
		cnt++;
}

out.println(cnt);

out.flush();
out.close();
}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main
{
static Stack<Integer> stack;
static int[][] adj;
static int[] size,weight_of_vertex,parent,visited;
static long[] dist,min;
static boolean[] removed_vertex;
static int n;
static Hashtable<Long,Integer> table;

public static void dfs(int source)
{
int time,val,j,edge_weight;
int number_of_nodes = n-1;
int element = source;
int i = source;
long key;
//System.out.print(element + "\t");
visited[source] = 1;
stack.push(source);

parent[0]=-1;
min[0]=0L;
//height[source]=1;
//time=1;

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		stack.push(i);
		visited[i] = 1;
		parent[i]=element;

		key=element*1000000L+i;
		edge_weight=table.get(key);
		dist[i]=dist[element]+edge_weight;

		if(i!=0)
			min[i]=Math.min(min[element],dist[i]);

		element = i;
		j = 0;
		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void bfs(int source)
{
int i,j,element,size_q,x,edge_weight;
long key;

visited[source]=1;

int[] queue=new int[n];
i=0;
size_q=1;
queue[i]=source;

parent[0]=-1;
min[0]=0L;

while(i<size_q)
{
element=queue[i];

for(j=0;j<size[element];j++)
	{

	x=adj[element][j];

	if (visited[x] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		parent[x]=element;

		key=element*1000000L+x;
		edge_weight=table.get(key);
		dist[x]=dist[element]+edge_weight;

		if(x!=0)
			min[x]=Math.min(min[element],dist[x]);

		visited[x]=1;

		queue[size_q++]=x;
		}
	}

i++;
}

}

public static void bfs1(int source)
{
int i,j,element,size_q,x;

Arrays.fill(visited,0);
visited[source]=1;

int[] queue=new int[n];
i=0;
size_q=1;
queue[i]=source;

while(i<size_q)
{
element=queue[i];

for(j=0;j<size[element];j++)
	{

	x=adj[element][j];

	if (visited[x] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(x!=0)
		{
			if(removed_vertex[element])
				removed_vertex[x]=true;
		}

		visited[x]=1;

		queue[size_q++]=x;
		}
	}

i++;
}

}

public static void dfs1(int source)
{
int time,val,j;
int number_of_nodes = n-1;
int element = source;
int i = source;

Arrays.fill(visited,0);
visited[source] = 1;
stack.push(source);

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(i!=0)
		{
			if(removed_vertex[element])
				removed_vertex[i]=true;
		}

		stack.push(i);
		visited[i] = 1;
		element = i;
		j = 0;

		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void main(String[] args)throws java.lang.Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);

int i,x,y,edge_weight,cnt;
long key,path_weight,cur_min;

n=Integer.parseInt(in.readLine());

int[] weight_of_vertex =new int[n];
int[][] connected=new int[n-1][2];
adj=new int[n][];
size=new int[n];
visited= new int[n];
dist=new long[n];
min=new long[n];
parent=new int[n];
removed_vertex=new boolean[n];
int[] cursize=new int[n];
stack = new Stack<Integer>();
table=new Hashtable<Long,Integer>();

StringTokenizer st=new StringTokenizer(in.readLine());

for(i=0;i<n;i++)
{
weight_of_vertex[i]=Integer.parseInt(st.nextToken());
}

for(i=0;i<n-1;i++)
{
StringTokenizer st1=new StringTokenizer(in.readLine().trim());

x=i+1;
y=Integer.parseInt(st1.nextToken().trim())-1;

connected[i][0]=x;
connected[i][1]=y;
edge_weight=Integer.parseInt(st1.nextToken().trim());

key=x*1000000L+y;
table.put(key,edge_weight);

key=y*1000000L+x;
table.put(key,edge_weight);

size[x]++;
size[y]++;
}

for(i=0;i<n;i++)
{
adj[i]=new int[size[i]];
}

for(i=0;i<n-1;i++)
{
x=connected[i][0];
y=connected[i][1];

adj[x][cursize[x]++]=y;
adj[y][cursize[y]++]=x;
}

bfs(0);
//dfs(0);

/*
for(i=0;i<n;i++)
{
	out.println(" "+dist[i]);
}

for(i=0;i<n;i++)
{
	out.println("->  "+min[i]);
}
*/

for(i=0;i<n;i++)
{
	if(i==0)
		cur_min=0L;
	else
		cur_min=min[parent[i]];

	path_weight=dist[i]-cur_min;
	if(path_weight>weight_of_vertex[i])
	{
		removed_vertex[i]=true;
		//out.println("*  "+(i+1));
	}
}

//stack.clear();

//dfs1(0);

bfs1(0);

cnt=0;

for(i=0;i<n;i++)
{
	if(removed_vertex[i])
		cnt++;
}

out.println(cnt);

out.flush();
out.close();
}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main
{
static Stack<Integer> stack;
static int[][] adj;
static int[] size,weight_of_vertex,parent;
static long[] dist,min;
static int n;
static Hashtable<Long,Integer> table;

public static void dfs(int source)
{
int time,val,j,edge_weight;
int number_of_nodes = n-1;
int visited[] = new int[number_of_nodes + 1];
parent=new int[n];
int element = source;
int i = source;
long key;
//System.out.print(element + "\t");
visited[source] = 1;
stack.push(source);

parent[0]=-1;
min[0]=0L;
//height[source]=1;
//time=1;

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		stack.push(i);
		visited[i] = 1;
		parent[i]=element;

		key=element*1000000L+i;
		edge_weight=table.get(key);
		dist[i]=dist[element]+edge_weight;

		if(i!=0)
			min[i]=Math.min(min[element],min[element]+edge_weight);

		element = i;
		j = 0;
		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void main(String[] args)throws java.lang.Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);

int i,x,y,edge_weight,cnt;
long key,path_weight,cur_min;

n=Integer.parseInt(in.readLine());

int[] weight_of_vertex =new int[n];
int[][] connected=new int[n-1][2];
adj=new int[n][];
size=new int[n];
dist=new long[n];
min=new long[n];
int[] cursize=new int[n];
stack = new Stack<Integer>();
table=new Hashtable<Long,Integer>();

StringTokenizer st=new StringTokenizer(in.readLine());

for(i=0;i<n;i++)
{
weight_of_vertex[i]=Integer.parseInt(st.nextToken());
}

for(i=0;i<n-1;i++)
{
StringTokenizer st1=new StringTokenizer(in.readLine().trim());

x=i+1;
y=Integer.parseInt(st1.nextToken().trim())-1;

connected[i][0]=x;
connected[i][1]=y;
edge_weight=Integer.parseInt(st1.nextToken().trim());

key=x*1000000L+y;
table.put(key,edge_weight);

key=y*1000000L+x;
table.put(key,edge_weight);

size[x]++;
size[y]++;
}

for(i=0;i<n;i++)
{
adj[i]=new int[size[i]];
}

for(i=0;i<n-1;i++)
{
x=connected[i][0];
y=connected[i][1];

adj[x][cursize[x]++]=y;
adj[y][cursize[y]++]=x;
}

dfs(0);

/*
for(i=0;i<n;i++)
{
	out.println(" "+dist[i]);
}
*/

cnt=0;

for(i=0;i<n;i++)
{
	if(i==0)
		cur_min=0L;
	else
		cur_min=min[parent[i]];

	path_weight=dist[i]-cur_min;
	if(path_weight>weight_of_vertex[i])
		cnt++;
}

out.println(cnt);

out.flush();
out.close();
}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main
{
static Stack<Integer> stack;
static int[][] adj;
static int[] size,weight_of_vertex,parent,visited;
static long[] dist,min;
static boolean[] removed_vertex,marked;
static int n;
static Hashtable<Long,Integer> table;

/*
public static void dfs(int source)
{
int time,val,j,edge_weight;
int number_of_nodes = n-1;
int element = source;
int i = source;
long key;
//System.out.print(element + "\t");
visited[source] = 1;
stack.push(source);

parent[0]=-1;
min[0]=0L;
//height[source]=1;
//time=1;

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		stack.push(i);
		visited[i] = 1;
		parent[i]=element;

		key=element*1000000L+i;
		edge_weight=table.get(key);
		dist[i]=dist[element]+edge_weight;

		if(i!=0)
			min[i]=Math.min(min[element],dist[i]);

		element = i;
		j = 0;
		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}
*/

    // depth first search from v
public static void dfs(int v)
{
	int edge_weight;
	long key;

        marked[v] = true;
        for (int w : adj[v])
        {
            if (!marked[w])
            {

            	parent[w]=v;

				key=v*1000000L+w;
				edge_weight=table.get(key);
				dist[w]=dist[v]+edge_weight;

				if(w!=0)
					min[w]=Math.min(min[v],dist[w]);

                dfs(w);
            }
        }
}

public static void bfs(int source)
{
int i,j,element,size_q,x,edge_weight;
long key;

visited[source]=1;

int[] queue=new int[n];
i=0;
size_q=1;
queue[i]=source;

parent[0]=-1;
min[0]=0L;

while(i<size_q)
{
element=queue[i];

for(j=0;j<size[element];j++)
	{

	x=adj[element][j];

	if (visited[x] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		parent[x]=element;

		key=element*1000000L+x;
		edge_weight=table.get(key);
		dist[x]=dist[element]+edge_weight;

		if(x!=0)
			min[x]=Math.min(min[element],dist[x]);

		visited[x]=1;

		queue[size_q++]=x;
		}
	}

i++;
}

}

public static void bfs1(int source)
{
int i,j,element,size_q,x;

Arrays.fill(visited,0);
visited[source]=1;

int[] queue=new int[n];
i=0;
size_q=1;
queue[i]=source;

while(i<size_q)
{
element=queue[i];

for(j=0;j<size[element];j++)
	{

	x=adj[element][j];

	if (visited[x] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(x!=0)
		{
			if(removed_vertex[element])
				removed_vertex[x]=true;
		}

		visited[x]=1;

		queue[size_q++]=x;
		}
	}

i++;
}

}

public static void dfs1(int source)
{
int time,val,j;
int number_of_nodes = n-1;
int element = source;
int i = source;

Arrays.fill(visited,0);
visited[source] = 1;
stack.push(source);

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(i!=0)
		{
			if(removed_vertex[element])
				removed_vertex[i]=true;
		}

		stack.push(i);
		visited[i] = 1;
		element = i;
		j = 0;

		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void main(String[] args)throws java.lang.Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);

int i,x,y,edge_weight,cnt;
long key,path_weight,cur_min;

n=Integer.parseInt(in.readLine());

int[] weight_of_vertex =new int[n];
int[][] connected=new int[n-1][2];
adj=new int[n][];
size=new int[n];
visited= new int[n];
dist=new long[n];
min=new long[n];
parent=new int[n];
marked=new boolean[n];
removed_vertex=new boolean[n];
int[] cursize=new int[n];
stack = new Stack<Integer>();
table=new Hashtable<Long,Integer>();

StringTokenizer st=new StringTokenizer(in.readLine());

for(i=0;i<n;i++)
{
weight_of_vertex[i]=Integer.parseInt(st.nextToken());
}

for(i=0;i<n-1;i++)
{
StringTokenizer st1=new StringTokenizer(in.readLine().trim());

x=i+1;
y=Integer.parseInt(st1.nextToken().trim())-1;

connected[i][0]=x;
connected[i][1]=y;
edge_weight=Integer.parseInt(st1.nextToken().trim());

key=x*1000000L+y;
table.put(key,edge_weight);

key=y*1000000L+x;
table.put(key,edge_weight);

size[x]++;
size[y]++;
}

for(i=0;i<n;i++)
{
adj[i]=new int[size[i]];
}

for(i=0;i<n-1;i++)
{
x=connected[i][0];
y=connected[i][1];

adj[x][cursize[x]++]=y;
adj[y][cursize[y]++]=x;
}

//bfs(0);
dfs(0);

/*
for(i=0;i<n;i++)
{
	out.println(" "+dist[i]);
}

for(i=0;i<n;i++)
{
	out.println("->  "+min[i]);
}
*/

for(i=0;i<n;i++)
{
	if(i==0)
		cur_min=0L;
	else
		cur_min=min[parent[i]];

	path_weight=dist[i]-cur_min;
	if(path_weight>weight_of_vertex[i])
	{
		removed_vertex[i]=true;
		//out.println("*  "+(i+1));
	}
}

//stack.clear();

//dfs1(0);

bfs1(0);

cnt=0;

for(i=0;i<n;i++)
{
	if(removed_vertex[i])
		cnt++;
}

out.println(cnt);

out.flush();
out.close();
}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.text.*;
public class Main
{
static Stack<Integer> stack;
static int[][] adj;
static int[] size,weight_of_vertex,parent;
static long[] dist,min;
static boolean[] removed_vertex;
static int n;
static Hashtable<Long,Integer> table;

public static void dfs(int source)
{
int time,val,j,edge_weight;
int number_of_nodes = n-1;
int visited[] = new int[number_of_nodes + 1];
parent=new int[n];
int element = source;
int i = source;
long key;
//System.out.print(element + "\t");
visited[source] = 1;
stack.push(source);

parent[0]=-1;
min[0]=0L;
//height[source]=1;
//time=1;

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		stack.push(i);
		visited[i] = 1;
		parent[i]=element;

		key=element*1000000L+i;
		edge_weight=table.get(key);
		dist[i]=dist[element]+edge_weight;

		if(i!=0)
			min[i]=Math.min(min[element],dist[i]);

		element = i;
		j = 0;
		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void dfs1(int source)
{
int time,val,j;
int number_of_nodes = n-1;
int visited[] = new int[number_of_nodes + 1];
int element = source;
int i = source;
//System.out.print(element + "\t");
visited[source] = 1;
stack.push(source);

//height[source]=1;
//time=1;

while (!stack.isEmpty())
{
element = stack.peek();

j=0;

while(j<size[element])
	{
	i=adj[element][j];

	if (visited[i] == 0)
		{
		//start[i]=time;
		//time++;

		//height[i]=height[element]+1;

		if(i!=0)
		{
			if(removed_vertex[element])
				removed_vertex[i]=true;
		}

		stack.push(i);
		visited[i] = 1;
		element = i;
		j = 0;

		//System.out.print(element + "\t");
		continue;
		}

	j++;
	}

val=stack.pop();
//end[val]=time;
//time++;

}

}

public static void main(String[] args)throws java.lang.Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out=new PrintWriter(System.out);

int i,x,y,edge_weight,cnt;
long key,path_weight,cur_min;

n=Integer.parseInt(in.readLine());

int[] weight_of_vertex =new int[n];
int[][] connected=new int[n-1][2];
adj=new int[n][];
size=new int[n];
dist=new long[n];
min=new long[n];
removed_vertex=new boolean[n];
int[] cursize=new int[n];
stack = new Stack<Integer>();
table=new Hashtable<Long,Integer>();

StringTokenizer st=new StringTokenizer(in.readLine());

for(i=0;i<n;i++)
{
weight_of_vertex[i]=Integer.parseInt(st.nextToken());
}

for(i=0;i<n-1;i++)
{
StringTokenizer st1=new StringTokenizer(in.readLine().trim());

x=i+1;
y=Integer.parseInt(st1.nextToken().trim())-1;

connected[i][0]=x;
connected[i][1]=y;
edge_weight=Integer.parseInt(st1.nextToken().trim());

key=x*1000000L+y;
table.put(key,edge_weight);

key=y*1000000L+x;
table.put(key,edge_weight);

size[x]++;
size[y]++;
}

for(i=0;i<n;i++)
{
adj[i]=new int[size[i]];
}

for(i=0;i<n-1;i++)
{
x=connected[i][0];
y=connected[i][1];

adj[x][cursize[x]++]=y;
adj[y][cursize[y]++]=x;
}

dfs(0);

/*
for(i=0;i<n;i++)
{
	out.println(" "+dist[i]);
}

for(i=0;i<n;i++)
{
	out.println("->  "+min[i]);
}
*/

for(i=0;i<n;i++)
{
	if(i==0)
		cur_min=0L;
	else
		cur_min=min[parent[i]];

	path_weight=dist[i]-cur_min;
	if(path_weight>weight_of_vertex[i])
	{
		removed_vertex[i]=true;
		//out.println("*  "+(i+1));
	}
}

stack.clear();

dfs1(0);

cnt=0;

for(i=0;i<n;i++)
{
	if(removed_vertex[i])
		cnt++;
}

out.println(cnt);

out.flush();
out.close();
}
}


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

public class CF358C {
	private FastScanner in;
	private PrintWriter out;
	int ans = 0;

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

	public void solve() throws IOException {
		int n = in.nextInt();
		int[] tree_v = new int[n+1];
		ArrayList<ArrayList<Pair>> tree = new ArrayList<ArrayList<Pair>>();
		for (int i = 0; i < 1000001; i++){
			tree.add(new ArrayList<Pair>());
		}
		for (int i = 1; i <= n; i++){
			tree_v[i] = in.nextInt();
		}
		for (int i = 2; i <= n; i++){
			int parent = in.nextInt();
			int v_edge = in.nextInt();
			Pair edge = new Pair(i, v_edge);
			tree.get(parent).add(edge);
		}
		dfs(tree_v, tree, 1, 0);
		out.println(n - ans);
	}

	// Count all nodes that we keep
	public void dfs(int[] tree_v, ArrayList<ArrayList<Pair>> tree, int node, long dist){
		if (dist > tree_v[node]){
			return;
		}
		ans++;
		for (int i = 0; i < tree.get(node).size(); i++){
			long distance = Math.max(dist + tree.get(node).get(i).b, 0L);
			dfs(tree_v, tree, tree.get(node).get(i).a, distance);
		}
	}

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

	public void run() {
		try {
			in = new FastScanner();
			out = new PrintWriter(System.out);
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

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

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

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

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

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


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

public class Solution {

    static int[] a;
    static boolean[] used;
    static Map<Integer, List<Edge>> adj;
    static long total;

    static class Edge {
        int to;
        int cost;

        public Edge(int to, int cost) {
            this.to = to;
            this.cost = cost;
        }
    }

    static void count(int current) {
        used[current] = true;
        total++;
        List<Edge> children = adj.containsKey(current) ? adj.get(current) : new ArrayList<Edge>();

        for (Edge e: children)
            if (!used[e.to]) {
                count(e.to);
            }
    }

    static void find(int current, long distance) {
        used[current] = true;
        List<Edge> children = adj.containsKey(current) ? adj.get(current) : new ArrayList<Edge>();

        for (Edge e: children)
            if (!used[e.to]) {
                long max = Math.max(distance + e.cost, e.cost);

                if (max > a[e.to]) {
                    count(e.to);
                } else {
                    find(e.to, max);
                }
            }
    }

    static void solve(InputReader in, OutputWriter out) {
        int n = in.nextInt();

        a = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            a[i] = in.nextInt();
        }

        adj = new HashMap<Integer, List<Edge>>();
        for (int i = 0; i < n - 1; i++) {
            int p = in.nextInt();
            int c = in.nextInt();

            if (!adj.containsKey(i + 2)) adj.put(i + 2, new ArrayList<Edge>());
            if (!adj.containsKey(p)) adj.put(p, new ArrayList<Edge>());

            adj.get(i + 2).add(new Edge(p, c));
            adj.get(p).add(new Edge(i + 2, c));
        }

        total = 0;
        used = new boolean[n + 1];
        find(1, 0);
        out.print(total);
    }

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        solve(in, out);
        in.close();
        out.close();
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        InputReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }

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

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String line = nextLine();
                if (line == null) return null;
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

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

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

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

        void close() {
            try {
                br.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    static class OutputWriter {
        BufferedWriter bw;

        OutputWriter(OutputStream os) {
            bw = new BufferedWriter(new OutputStreamWriter(os));
        }

        void print(int i) {
            print(Integer.toString(i));
        }

        void println(int i) {
            println(Integer.toString(i));
        }

        void print(long l) {
            print(Long.toString(l));
        }

        void println(long l) {
            println(Long.toString(l));
        }

        void print(double d) {
            print(Double.toString(d));
        }

        void println(double d) {
            println(Double.toString(d));
        }

        void print(boolean b) {
            print(Boolean.toString(b));
        }

        void println(boolean b) {
            println(Boolean.toString(b));
        }

        void print(char c) {
            try {
                bw.write(c);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        void println(char c) {
            println(Character.toString(c));
        }

        void print(String s) {
            try {
                bw.write(s);
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

        void println(String s) {
            print(s);
            print('\n');
        }

        void close() {
            try {
                bw.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;

// Codeforces Round #358 (Div. 2)
// Alyona and the Tree
public class Problem_682_C {

	private void doSolve(PrintWriter out) {
		long start = System.currentTimeMillis();
		int n = nextInt();
		int[] a = new int[n];
		Node[] node = new Node[n];

		for (int i = 0; i < n; i++) {
			node[i] = new Node();
			node[i].value = nextInt();
			node[i].nodeId = i;
		}

		for (int i = 0; i < n - 1; i++) {
			int p = nextInt();
			int c = nextInt();
			node[i + 1].neighbours.put(node[p - 1], c);
			node[p - 1].neighbours.put(node[i + 1], c);
		}
		node[0].assignParentRecursively(null);
		node[0].updateSubtreeNodesCount();
		Deque<Node> toProcess = new LinkedList<Node>();
		toProcess.add(node[0]);

		int nodesToDelete = 0;
		int counter = 0;
		Node currentNode;

		while (toProcess.size() > 0) {
			counter++;
			if (counter % 1000 == 0) {
				long current = System.currentTimeMillis();
				if (current - start > 900) {
					out.print("counter = " + counter);
				}
			}
			currentNode = toProcess.removeLast();
			if (currentNode.makesAscendorsSad()) {
				nodesToDelete += currentNode.nodesInSubtree;
			}
			else {
				for (Node child : currentNode.neighbours.keySet()) {
					toProcess.addFirst(child);
				}
			}
		}
		out.print(nodesToDelete);
	}

	private static class Node {
		Map<Node, Integer> neighbours = new HashMap<Node, Integer>();
		Node parent;
		int nodesInSubtree;
		int value;
		int nodeId;

		private boolean makesAscendorsSad() {
			Node upperNode = parent;
			Node lowerNode = this;
			long dist = 0;
			while (upperNode != null) {
				dist += upperNode.neighbours.get(lowerNode);
				if (dist > value) {
					return true;
				}
				lowerNode = upperNode;
				upperNode = upperNode.parent;
			}
			return false;
		}

		int updateSubtreeNodesCount() {
			nodesInSubtree = 1; // count itself
			for (Node child : neighbours.keySet()) {
				nodesInSubtree += child.updateSubtreeNodesCount();
			}
			return nodesInSubtree;
		}

		private void assignParentRecursively(Node parent) {
			this.parent = parent;
			if (parent != null) {
				neighbours.remove(parent);
			}
			for (Node child : neighbours.keySet()) {
				child.assignParentRecursively(this);
			}
		}

		public String toString() {
			return "node " + (nodeId + 1) + "; " + nodesInSubtree + " children";
		}

	}
	/* ========================================================= */

    private InputReader inputReader;

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

    public int nextInt() {
    	return inputReader.nextInt();
    }

    public String next() {
    	return inputReader.next();
    }

    public void solve(int test, Reader in, PrintWriter out)
    {
    	inputReader = new InputReader(in);
    	doSolve(out);

    }

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

        public InputReader(Reader reader) {
            this.reader = new BufferedReader(reader, 32768);
            tokenizer = null;
        }

        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 int nextInt() {
            return Integer.parseInt(next());
        }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;

// Codeforces Round #358 (Div. 2)
// Alyona and the Tree
public class Problem_682_C {

	private void doSolve(PrintWriter out) {
		int n = nextInt();
		int[] a = new int[n];
		Node[] node = new Node[n];

		for (int i = 0; i < n; i++) {
			node[i] = new Node();
			node[i].value = nextInt();
			node[i].nodeId = i;
		}

		for (int i = 0; i < n - 1; i++) {
			int p = nextInt();
			int c = nextInt();
			node[i + 1].neighbours.put(node[p - 1], c);
			node[p - 1].neighbours.put(node[i + 1], c);
		}
		node[0].assignParentRecursively(null);
		node[0].updateSubtreeNodesCount();

		Deque<Node> toProcess = new LinkedList<Node>();
		toProcess.add(node[0]);

		int nodesToDelete = 0;
		Node currentNode;
		while (toProcess.size() > 0) {
			currentNode = toProcess.removeLast();
			if (currentNode.makesAscendorsSad()) {
				nodesToDelete += currentNode.nodesInSubtree;
			}
			else {
				for (Node child : currentNode.neighbours.keySet()) {
					toProcess.addFirst(child);
				}
			}
		}
		out.print(nodesToDelete);
	}

	private static class Node {
		Map<Node, Integer> neighbours = new HashMap<Node, Integer>();
		Node parent;
		int nodesInSubtree;
		int value;
		int nodeId;

		private boolean makesAscendorsSad() {
			Node upperNode = parent;
			Node lowerNode = this;
			long dist = 0;
			while (upperNode != null) {
				dist += upperNode.neighbours.get(lowerNode);
				if (dist > value) {
					return true;
				}
				lowerNode = upperNode;
				upperNode = upperNode.parent;
			}
			return false;
		}

		int updateSubtreeNodesCount() {
			nodesInSubtree = 1; // count itself
			for (Node child : neighbours.keySet()) {
				nodesInSubtree += child.updateSubtreeNodesCount();
			}
			return nodesInSubtree;
		}

		private void assignParentRecursively(Node parent) {
			this.parent = parent;
			if (parent != null) {
				neighbours.remove(parent);
			}
			for (Node child : neighbours.keySet()) {
				child.assignParentRecursively(this);
			}
		}

		public String toString() {
			return "node " + (nodeId + 1) + "; " + nodesInSubtree + " children";
		}

	}
	/* ========================================================= */

    private InputReader inputReader;

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

    public int nextInt() {
    	return inputReader.nextInt();
    }

    public String next() {
    	return inputReader.next();
    }

    public void solve(int test, Reader in, PrintWriter out)
    {
    	inputReader = new InputReader(in);
    	doSolve(out);

    }

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

        public InputReader(Reader reader) {
            this.reader = new BufferedReader(reader, 32768);
            tokenizer = null;
        }

        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 int nextInt() {
            return Integer.parseInt(next());
        }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;

// Codeforces Round #358 (Div. 2)
// Alyona and the Tree
public class Problem_682_C {

	private void doSolve(PrintWriter out) {
		int n = nextInt();
		Node[] node = new Node[n];

		for (int i = 0; i < n; i++) {
			node[i] = new Node();
			node[i].value = nextInt();
			node[i].nodeId = i;
		}

		for (int i = 0; i < n - 1; i++) {
			int p = nextInt();
			int c = nextInt();
			node[i + 1].neighbours.put(node[p - 1], c);
			node[p - 1].neighbours.put(node[i + 1], c);
		}
		node[0].assignParentRecursively(null);
		node[0].updateSubtreeNodesCount();
		Deque<Node> toProcess = new LinkedList<Node>();
		toProcess.add(node[0]);

		int nodesToDelete = 0;
		Node currentNode;

		while (toProcess.size() > 0) {
			currentNode = toProcess.removeLast();
			if (currentNode.makesAscendorsSad()) {
				nodesToDelete += currentNode.nodesInSubtree;
			}
			else {
				for (Node child : currentNode.neighbours.keySet()) {
					toProcess.addFirst(child);
				}
			}
		}
		out.print(nodesToDelete);
	}

	private static class Node {
		Map<Node, Integer> neighbours = new HashMap<Node, Integer>();
		Node parent;
		int nodesInSubtree;
		int value;
		int nodeId;
		Integer maxDistToAscendors;

		private boolean makesAscendorsSad() {
			if (parent == null) {
				maxDistToAscendors = 0;
				return false;
			}
			int distanceToParent = parent.neighbours.get(this);
			maxDistToAscendors = Math.max(distanceToParent, parent.maxDistToAscendors);
			return maxDistToAscendors > value;
		}

		int updateSubtreeNodesCount() {
			nodesInSubtree = 1; // count itself
			for (Node child : neighbours.keySet()) {
				nodesInSubtree += child.updateSubtreeNodesCount();
			}
			return nodesInSubtree;
		}

		private void assignParentRecursively(Node parent) {
			this.parent = parent;
			if (parent != null) {
				neighbours.remove(parent);
			}
			for (Node child : neighbours.keySet()) {
				child.assignParentRecursively(this);
			}
		}

		public String toString() {
			return "node " + (nodeId + 1) + "; " + nodesInSubtree + " children";
		}

	}
	/* ========================================================= */

    private InputReader inputReader;

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

    public int nextInt() {
    	return inputReader.nextInt();
    }

    public String next() {
    	return inputReader.next();
    }

    public void solve(int test, Reader in, PrintWriter out)
    {
    	inputReader = new InputReader(in);
    	doSolve(out);

    }

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

        public InputReader(Reader reader) {
            this.reader = new BufferedReader(reader, 32768);
            tokenizer = null;
        }

        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 int nextInt() {
            return Integer.parseInt(next());
        }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.Deque;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.StringTokenizer;

// Codeforces Round #358 (Div. 2)
// Alyona and the Tree
public class Problem_682_C {

	private void doSolve(PrintWriter out) {
		int n = nextInt();
		Node[] node = new Node[n];

		for (int i = 0; i < n; i++) {
			node[i] = new Node();
			node[i].value = nextInt();
			node[i].nodeId = i;
		}

		for (int i = 0; i < n - 1; i++) {
			int p = nextInt();
			int c = nextInt();
			node[i + 1].neighbours.put(node[p - 1], c);
			node[p - 1].neighbours.put(node[i + 1], c);
		}
		node[0].assignParentRecursively(null);
		node[0].updateSubtreeNodesCount();
		Deque<Node> toProcess = new LinkedList<Node>();
		toProcess.add(node[0]);

		int nodesToDelete = 0;
		Node currentNode;

		while (toProcess.size() > 0) {
			currentNode = toProcess.removeLast();
			if (currentNode.makesAscendorsSad()) {
				nodesToDelete += currentNode.nodesInSubtree;
			}
			else {
				for (Node child : currentNode.neighbours.keySet()) {
					toProcess.addFirst(child);
				}
			}
		}
		out.print(nodesToDelete);
	}

	private static class Node {
		Map<Node, Integer> neighbours = new HashMap<Node, Integer>();
		Node parent;
		int nodesInSubtree;
		int value;
		int nodeId;
		Integer maxDistToAscendors;

		private boolean makesAscendorsSad() {
			if (parent == null) {
				maxDistToAscendors = 0;
				return false;
			}
			int distanceToParent = parent.neighbours.get(this);
			maxDistToAscendors = Math.max(distanceToParent, parent.maxDistToAscendors + distanceToParent);
			return maxDistToAscendors > value;
		}

		int updateSubtreeNodesCount() {
			nodesInSubtree = 1; // count itself
			for (Node child : neighbours.keySet()) {
				nodesInSubtree += child.updateSubtreeNodesCount();
			}
			return nodesInSubtree;
		}

		private void assignParentRecursively(Node parent) {
			this.parent = parent;
			if (parent != null) {
				neighbours.remove(parent);
			}
			for (Node child : neighbours.keySet()) {
				child.assignParentRecursively(this);
			}
		}

		public String toString() {
			return "node " + (nodeId + 1) + "; " + nodesInSubtree + " children";
		}

	}
	/* ========================================================= */

    private InputReader inputReader;

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

    public int nextInt() {
    	return inputReader.nextInt();
    }

    public String next() {
    	return inputReader.next();
    }

    public void solve(int test, Reader in, PrintWriter out)
    {
    	inputReader = new InputReader(in);
    	doSolve(out);

    }

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

        public InputReader(Reader reader) {
            this.reader = new BufferedReader(reader, 32768);
            tokenizer = null;
        }

        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 int nextInt() {
            return Integer.parseInt(next());
        }

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                ar[par].children.add(ar[i]);

            }

            ArrayList<Integer> way = new ArrayList<Integer>();
            way.add(0);
            leave++;
            for (Node next:ar[0].children)
            {
                ArrayList<Integer> wayNext = new ArrayList<>(way);
                iterate(ar[0], next, 0,wayNext);
            }

            System.out.println(n - leave);

        }
        static int leave = 0;
        static void iterate(Node par, Node next, long sum, ArrayList<Integer> way)
        {
            long minus = 0;
            for (int i = 0; i < way.size(); i++)
            {
                minus = minus +  way.get(i);
                if (sum - minus + next.toP > next.value){return;}
            }
            way.add((int)next.toP);
            leave++;
            for (Node nextnext:next.children)
            {
                ArrayList<Integer> newList = new ArrayList<Integer>(way);
                iterate(next, nextnext, sum + next.toP,newList);
            }
        }

        static class Node
        {
            ArrayList<Node> children = new ArrayList<Node>();
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }

    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                if (ar[par].l == null){ar[par].l = ar[i];}
                else {ar[par].r = ar[i];}

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            ArrayList<Integer> way = new ArrayList<Integer>();
            way.add(0);
            remove++;
            if (ar[0].l != null)
            {
                iterate(ar[0], ar[0].l, 0,way);
            }
            if (ar[0].r != null)
            {
                iterate(ar[0], ar[0].r, 0,way);
            }

            System.out.println(n - remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum, ArrayList<Integer> way)
        {
            long minus = 0;
            for (int i = 0; i < way.size(); i++)
            {
                minus = minus +  way.indexOf(i);
                if (sum - minus + next.toP > next.value){return;}
            }
            way.add((int)next.toP);
            remove++;
            if (next.l != null)
            {
                iterate(next, next.l, sum + next.toP,way);
            }
            if (next.r != null)
            {
                iterate(next, next.r, sum + next.toP, way);
            }
        }

        static class Node
        {
            Node l;
            Node r;
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                ar[par].children.add(ar[i]);

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            ArrayList<Integer> way = new ArrayList<Integer>();
            way.add(0);
            remove++;
            for (Node next:ar[0].children)
            {
                ArrayList<Integer> wayNext = new ArrayList<>(way);
                iterate(ar[0], next, 0,wayNext);
            }

            System.out.println(n - remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum, ArrayList<Integer> way)
        {
            long minus = 0;
            for (int i = 0; i < way.size(); i++)
            {
                minus = minus +  way.get(i);
                if (sum - minus + next.toP > next.value){return;}
            }
            way.add((int)next.toP);
            remove++;
            for (Node nextnext:next.children)
            {
                ArrayList<Integer> newList = new ArrayList<Integer>(way);
                iterate(next, nextnext, sum + next.toP,newList);
            }
        }

        static class Node
        {
            ArrayList<Node> children = new ArrayList<Node>();
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                if (ar[par].l == null){ar[par].l = ar[i];}
                else {ar[par].r = ar[i];}

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            if (ar[0].l != null)
            {
                iterate(ar[0], ar[0].l, 0);
            }
            if (ar[0].r != null)
            {
                iterate(ar[0], ar[0].r, 0);
            }

            System.out.println(remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum)
        {
            if (sum + next.toP > next.value){remove(next);if (par.l == next) par.l = null; else par.r = null;}
            else
            {
                if (next.l != null)
                {
                    iterate(next, next.l, sum + next.toP);

                }
                if (next.r != null)
                {
                    iterate(next, next.r, sum + next.toP);
                }

                if (next.l != null && next.toP < 0)
                {
                    iterate(next, next.l, 0);

                }
                if (next.r != null && next.toP < 0)
                {
                    iterate(next, next.r, 0);
                }
            }
        }

        static void remove(Node next)
        {

            remove++;
            if (next.l != null)
            {
                remove(next.l);
            }
            if (next.r != null)
            {
                remove(next.r);
            }
        }
        static class Node
        {
            Node l;
            Node r;
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                if (ar[par].l == null){ar[par].l = ar[i];}
                else {ar[par].r = ar[i];}

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            ArrayList<Integer> way1 = new ArrayList<Integer>();
            ArrayList<Integer> way2 = new ArrayList<Integer>();
            way1.add(0);
            way2.add(0);
            remove++;
            if (ar[0].l != null)
            {
                iterate(ar[0], ar[0].l, 0,way1);
            }
            if (ar[0].r != null)
            {
                iterate(ar[0], ar[0].r, 0,way2);
            }

            System.out.println(n - remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum, ArrayList<Integer> way)
        {
            long minus = 0;
            for (int i = 0; i < way.size(); i++)
            {
                minus = minus +  way.get(i);
                if (sum - minus + next.toP > next.value){return;}
            }
            way.add((int)next.toP);
            remove++;
            ArrayList<Integer> newList = new ArrayList<Integer>(way);
            if (next.l != null)
            {
                iterate(next, next.l, sum + next.toP,way);
            }
            if (next.r != null)
            {
                iterate(next, next.r, sum + next.toP, newList);
            }
        }

        static class Node
        {
            Node l;
            Node r;
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                if (ar[par].l == null){ar[par].l = ar[i];}
                else {ar[par].r = ar[i];}

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            ArrayList<Integer> way = new ArrayList<Integer>();
            way.add(0);
            remove++;
            if (ar[0].l != null)
            {
                iterate(ar[0], ar[0].l, 0,way);
            }
            if (ar[0].r != null)
            {
                iterate(ar[0], ar[0].r, 0,way);
            }

            System.out.println(n - remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum, ArrayList<Integer> way)
        {
            long minus = 0;
            for (Integer i : way)
            {
                minus = minus +  (long)i;
                if (sum - minus + next.toP > next.value){return;}
            }
            way.add((int)next.toP);
            remove++;
            if (next.l != null)
            {

                iterate(next, next.l, sum + next.toP,way);

            }
            if (next.r != null)
            {
                iterate(next, next.r, sum + next.toP, way);
            }
        }

        static void remove(Node next)
        {

            //remove++;
            if (next.l != null)
            {
                remove(next.l);
            }
            if (next.r != null)
            {
                remove(next.r);
            }
        }
        static class Node
        {
            Node l;
            Node r;
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                if (ar[par].l == null){ar[par].l = ar[i];}
                else {ar[par].r = ar[i];}

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            ArrayList<Integer> way = new ArrayList<Integer>();
            way.add(0);
            remove++;
            if (ar[0].l != null)
            {
                iterate(ar[0], ar[0].l, 0,way);
            }
            if (ar[0].r != null)
            {
                iterate(ar[0], ar[0].r, 0,way);
            }

            System.out.println(n - remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum, ArrayList<Integer> way)
        {
            long minus = 0;
            for (Integer i : way)
            {
                minus += i;
                if (sum - minus + next.toP > next.value){return;}
            }
            way.add((int)next.toP);
            remove++;
            if (next.l != null)
            {

                iterate(next, next.l, sum + next.toP,way);

            }
            if (next.r != null)
            {
                iterate(next, next.r, sum + next.toP, way);
            }
        }

        static void remove(Node next)
        {

            //remove++;
            if (next.l != null)
            {
                remove(next.l);
            }
            if (next.r != null)
            {
                remove(next.r);
            }
        }
        static class Node
        {
            Node l;
            Node r;
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.*;

public class R3 {
    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) {
            int n = in.readInt();
            Node[] ar = new Node[n];
            for (int i = 0; i < n ; i++)
            {
                ar[i] = new Node(in.readInt());
            }
            for (int i = 1; i < n; i++){
                int par = in.readInt()-1;
                long parV = in.readInt();
                ar[i].toP = parV;
                if (ar[par].l == null){ar[par].l = ar[i];}
                else {ar[par].r = ar[i];}

            }

            //for (Node i:ar){System.out.println(i.value + " " + i.toP + " " + (i.l != null ? i.l.value : "null") + " " + (i.r != null ? i.r.value : "null"));}

            if (ar[0].l != null)
            {
                iterate(ar[0], ar[0].l, 0);
            }
            if (ar[0].r != null)
            {
                iterate(ar[0], ar[0].r, 0);
            }

            System.out.println(remove);

        }
        static int remove = 0;
        static void iterate(Node par, Node next, long sum)
        {
            if (sum + next.toP > next.value){remove(next);if (par.l == next) par.l = null; else par.r = null;}
            else
            {
                if (next.l != null)
                {
                    iterate(next, next.l, sum + next.toP);

                }
                if (next.r != null)
                {
                    iterate(next, next.r, sum + next.toP);
                }

                if (next.l != null && next.l.toP < 0)
                {
                    iterate(next, next.l, 0);

                }
                if (next.r != null && next.r.toP < 0)
                {
                    iterate(next, next.r, 0);
                }
            }
        }

        static void remove(Node next)
        {

            remove++;
            if (next.l != null)
            {
                remove(next.l);
            }
            if (next.r != null)
            {
                remove(next.r);
            }
        }
        static class Node
        {
            Node l;
            Node r;
            long toP;
            long value;

            Node(long value)
            {
                this.value = value;
            }
        }
        private static long gcd(long a, long b)
        {
            while (b > 0)
            {
                long temp = b;
                b = a % b; // % is remainder
                a = temp;
            }
            return a;
        }

        private static long lcm(long a, long b)
        {
            return a * (b / gcd(a, b));
        }
    }

    static class IOUtils {
        public static int[] readIntArray(InputReader in, int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++) {
                array[i] = in.readInt();
            }
            return array;
        }

    }

    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 printLine(int i) {
            writer.println(i);
        }

    }

    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 char readCharacter() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            return (char) c;
        }

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

        }

    }
}