import java.util.ArrayList;
import java.util.Scanner;

public class WorkFile {
    public static int[] dfs(int[] array, ArrayList<int[]>[] tree,
                            int item, int prev, int path, int minpath) {
        int result = 0, amount = 1;
        for (int[] elem:tree[item]) {
            int x = elem[0], len = elem[1];
            if (x==prev) continue;
            int newpath = path+len;
            int newminpath = Math.min(minpath, newpath);
            int[] list = dfs(array, tree, x, item, newpath, newminpath);
            result+=list[0]; amount+=list[1];
        }
        if (path-minpath>array[item]) result = amount;
        return new int[]{result, amount};
    }
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int[] array = new int[n];
        ArrayList<int[]>[] tree = new ArrayList[n];
        for (int i=0; i<n; i++) {
            array[i] = s.nextInt();
            tree[i] = new ArrayList<int[]>();
        }
        for (int i=1; i<n; i++) {
            int x = s.nextInt()-1, len = s.nextInt();
            tree[i].add(new int[]{x, len});
            tree[x].add(new int[]{i, len});
        }
        System.out.println(dfs(array, tree, 0, -1, 0, 0)[0]);
    }
}


import java.util.ArrayList;
import java.util.Scanner;

public class WorkFile {
    public static int[] dfs(long[] array, ArrayList<int[]>[] tree,
                            int item, int prev, long path, long minpath) {
        int result = 0, amount = 1;
        for (int[] elem:tree[item]) {
            int x = elem[0], len = elem[1];
            if (x==prev) continue;
            long newpath = path+len;
            long newminpath = Math.min(minpath, newpath);
            int[] list = dfs(array, tree, x, item, newpath, newminpath);
            result+=list[0]; amount+=list[1];
        }
        if (path-minpath>array[item]) result = amount;
        return new int[]{result, amount};
    }
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        long[] array = new long[n];
        ArrayList<int[]>[] tree = new ArrayList[n];
        for (int i=0; i<n; i++) {
            array[i] = s.nextInt();
            tree[i] = new ArrayList<int[]>();
        }
        for (int i=1; i<n; i++) {
            int x = s.nextInt()-1, len = s.nextInt();
            tree[i].add(new int[]{x, len});
            tree[x].add(new int[]{i, len});
        }
        System.out.println(dfs(array, tree, 0, -1, 0, 0)[0]);
    }
}


import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7
{
	static class Pair
	{
		int x;
		int y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
	static int mod=1000000007;
	public static int[] sort(int[] a)
	{
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++)
		{
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++)
		{
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b)
    {
        long result=1;
        while(b>0)
        {
            if (b % 2 != 0)
            {
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b)
	{
		return a*(b/gcd(a,b));
	}
	static ArrayList<ArrayList<Pair>> graph;
	static public void main(String args[])throws IOException
	{
		int tt=1;
		StringBuilder sb=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++)
		{
			int n=i();
			int[] a=new int[n];
			graph=new ArrayList<>();
			for(int i=0;i<n;i++)
			{
				graph.add(new ArrayList<>());
				a[i]=i();
			}

			int[] parent=new int[n-1];
			int[] edge=new int[n-1];
			for(int i=0;i<n-1;i++)
			{
				parent[i]=i()-1;
				edge[i]=i();
				graph.get(i+1).add(new Pair(parent[i],edge[i]));
				graph.get(parent[i]).add(new Pair(i+1,edge[i]));
			}
			boolean[] visited=new boolean[n];
			subtree=new int[n];
			dfs1(0,visited);
			visited=new boolean[n];
			ans=0;
			dfs(0,visited,0,a);
			sb.append(ans+"\n");
		}
		System.out.print(sb.toString());
	}
	static int[] subtree;
	static void dfs1(int src, boolean[] visited)
	{
		visited[src]=true;
		subtree[src]=1;
		ArrayList<Pair> ar=graph.get(src);
		for(int i=0;i<ar.size();i++)
		{
			int num=ar.get(i).x;
			if(visited[num]==false)
			{
				dfs1(num,visited);
				subtree[src]+=subtree[num];
			}
		}
	}
	static int ans=0;
	static void dfs(int src, boolean[] visited,long dis,int[] a)
	{
		if(dis>a[src])
		{
			ans+=subtree[src];
			visited[src]=true;
			return;
		}
		visited[src]=true;
		ArrayList<Pair> ar=graph.get(src);
		for(int i=0;i<ar.size();i++)
		{
			int num=ar.get(i).x;
			long edge=ar.get(i).y;
			if(visited[num]==false)
			{
				dfs(num,visited,edge+dis,a);
			}
		}
	}
			/**/
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	public static long l()
	{
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value)
	{
		System.out.println(value);
	}
	public static int i()
	{
		return in.Int();
	}
	public static String s()
	{
		return in.String();
	}
}
	class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private 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 Int() {
			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 String String() {
			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 boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

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

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

	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 print(Object...objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object...objects) {
			print(objects);
			writer.println();
		}

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

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

		}

		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.Int();
			return array;
		}

	}


import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.io.*;
import java.math.*;
public class Main7
{
	static class Pair
	{
		int x;
		int y;
		Pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
	}
	static int mod=1000000007;
	public static int[] sort(int[] a)
	{
		int n=a.length;
		ArrayList<Integer> ar=new ArrayList<>();
		for(int i=0;i<a.length;i++)
		{
			ar.add(a[i]);
		}
		Collections.sort(ar);
		for(int i=0;i<n;i++)
		{
			a[i]=ar.get(i);
		}
		return a;
	}
	public static long pow(long a, long b)
    {
        long result=1;
        while(b>0)
        {
            if (b % 2 != 0)
            {
                result=(result*a);
                b--;
            }
            a=(a*a);
            b /= 2;
        }
        return result;
    }

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b%a, a);
    }
	public static long lcm(long a, long b)
	{
		return a*(b/gcd(a,b));
	}
	static ArrayList<ArrayList<Pair>> graph;
	static public void main(String args[])throws IOException
	{
		int tt=1;
		StringBuilder sb=new StringBuilder();
		for(int ttt=1;ttt<=tt;ttt++)
		{
			int n=i();
			int[] a=new int[n];
			graph=new ArrayList<>();
			for(int i=0;i<n;i++)
			{
				graph.add(new ArrayList<>());
				a[i]=i();
			}

			int[] parent=new int[n-1];
			int[] edge=new int[n-1];
			for(int i=0;i<n-1;i++)
			{
				parent[i]=i()-1;
				edge[i]=i();
				graph.get(i+1).add(new Pair(parent[i],edge[i]));
				graph.get(parent[i]).add(new Pair(i+1,edge[i]));
			}
			boolean[] visited=new boolean[n];
			subtree=new int[n];
			dfs1(0,visited);
			visited=new boolean[n];
			ans=0;
			dfs(0,visited,0,a);
			sb.append(ans+"\n");
		}
		System.out.print(sb.toString());
	}
	static int[] subtree;
	static void dfs1(int src, boolean[] visited)
	{
		visited[src]=true;
		subtree[src]=1;
		ArrayList<Pair> ar=graph.get(src);
		for(int i=0;i<ar.size();i++)
		{
			int num=ar.get(i).x;
			if(visited[num]==false)
			{
				dfs1(num,visited);
				subtree[src]+=subtree[num];
			}
		}
	}
	static int ans=0;
	static void dfs(int src, boolean[] visited,long dis,int[] a)
	{
		if(dis>a[src])
		{
			ans+=subtree[src];
			visited[src]=true;
			return;
		}
		visited[src]=true;
		ArrayList<Pair> ar=graph.get(src);
		for(int i=0;i<ar.size();i++)
		{
			int num=ar.get(i).x;
			long edge=ar.get(i).y;
			if(visited[num]==false)
			{
				if(dis<0)
					dis=0;
				dfs(num,visited,edge+dis,a);
			}
		}
	}
			/**/
	static InputReader in=new InputReader(System.in);
	static OutputWriter out=new OutputWriter(System.out);
	public static long l()
	{
		String s=in.String();
		return Long.parseLong(s);
	}
	public static void pln(String value)
	{
		System.out.println(value);
	}
	public static int i()
	{
		return in.Int();
	}
	public static String s()
	{
		return in.String();
	}
}
	class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private 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 Int() {
			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 String String() {
			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 boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

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

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

	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 print(Object...objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object...objects) {
			print(objects);
			writer.println();
		}

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

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

		}

		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.Int();
			return array;
		}

	}


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

public class dfs
{
    static int n;
    static LinkedList<Integer> adj[];
    static HashMap<String, Integer> hm;
    static int counter;
    static int vis[];
    static int arr[];
    static int problem[];
    static Set<Integer> hs;
    public static void dfs(int pos,int activate,long sum)
    {
        vis[pos]=1;
        if(activate==1)
        {
            counter++;
        }
        if(activate!=1)
        {
        	for(int i : adj[pos])
        	{
        	     if(vis[i]==-1)
        	     {
            		 if((Math.max(hm.get(pos+"$"+i),sum+hm.get(pos+"$"+i))>arr[i]))
            		   dfs(i,1,Math.max(hm.get(pos+"$"+i),sum+hm.get(pos+"$"+i)));
            		  else
            		   dfs(i,0,Math.max(hm.get(pos+"$"+i),sum+hm.get(pos+"$"+i)));
                 }
            }
        }
        else
        {
            for(int i : adj[pos])
        	{
        	    if(vis[i]==-1)
        	     {
            		 dfs(i,1,sum);
                 }
            }
        }
    }

    public static void main(String args[])throws IOException
    {
        counter=0;
       Reader sc=new Reader();
       n =sc.nextInt();
       adj = new LinkedList[n];
       hm= new HashMap<String, Integer>();
       vis=new int[n];
       hs = new HashSet<Integer>();
       arr=new int[n];
       Arrays.fill(vis,-1);

       for (int i=0; i<n; ++i)
       adj[i] = new LinkedList();

       for(int i = 0 ;i<n;i++)
       arr[i]=sc.nextInt();

       for(int i = 1;i<n;i++)
       {
            int u =  sc.nextInt();
            int value=  sc.nextInt();
            u--;
            hm.put(u+"$"+i,value);
            hm.put(i+"$"+u,value);
            adj[i].add(u);
            adj[u].add(i);
       }
       dfs(0,0,0);
       System.out.println(counter);
    }
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}


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

public class dfs
{
    static int n;
    static LinkedList<Integer> adj[];
    static HashMap<String, Integer> hm;
    static int counter;
    static int vis[];
    static int arr[];
    static int problem[];
    static Set<Integer> hs;
    public static void dfs(int pos,int activate,long sum)
    {
        vis[pos]=1;
        if(activate==1)
        counter++;
    	for(int i : adj[pos])
    	{
    		if(vis[i]==-1)
    		{
    		    if(hm.get(pos+"$"+i)+sum>arr[i])
    		    dfs(i,1,hm.get(pos+"$"+i)+sum);
    		    else
    		    dfs(i,activate,hm.get(pos+"$"+i)+sum);
    		}
    	}
    }

    public static void main(String args[])throws IOException
    {
        counter=0;
       Reader sc=new Reader();
       n =sc.nextInt();
       adj = new LinkedList[n];
       hm= new HashMap<String, Integer>();
       vis=new int[n];
       hs = new HashSet<Integer>();
       arr=new int[n];
       Arrays.fill(vis,-1);

       for (int i=0; i<n; ++i)
       adj[i] = new LinkedList();

       for(int i = 0 ;i<n;i++)
       arr[i]=sc.nextInt();

       for(int i = 1;i<n;i++)
       {
            int u =  sc.nextInt();
            int value=  sc.nextInt();
            u--;
            hm.put(i+"$"+u,value);
            hm.put(u+"$"+i,value);
            adj[i].add(u);
            adj[u].add(i);
       }
       dfs(0,0,0);
       System.out.println(counter);
    }
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}


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

public class C
{
	public static long[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, long minSoFar, long sumSoFar, boolean fail)
	{
		if(dp[u] < (sumSoFar - minSoFar) || fail == true) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v;
			long w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new long[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v;
    	long w;
    	public Edge(int v, long w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static long[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, long minSoFar, long sumSoFar, boolean fail)
	{
		if(dp[u] <= (sumSoFar - minSoFar) || fail == true) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v;
			long w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new long[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v;
    	long w;
    	public Edge(int v, long w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static int[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, int minSoFar, int sumSoFar, boolean fail)
	{
		if(dp[u] < sumSoFar || fail == true) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v, w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new int[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v, w;
    	public Edge(int v, int w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static int[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, int minSoFar, int sumSoFar, boolean fail)
	{
		if(dp[u] < sumSoFar) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v, w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new int[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v, w;
    	public Edge(int v, int w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static int[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, int minSoFar, int sumSoFar, boolean fail)
	{
		if(dp[u] <= (sumSoFar - minSoFar) || fail == true) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v, w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new int[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v, w;
    	public Edge(int v, int w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static int[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, int minSoFar, int sumSoFar, boolean fail)
	{
		if(dp[u] < (sumSoFar - minSoFar) || fail == true) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v, w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new int[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v, w;
    	public Edge(int v, int w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static int[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, int minSoFar, int sumSoFar, boolean fail)
	{
		if(dp[u] < sumSoFar || fail == true) {
			fail = true;
			cnt++;
			out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v, w = i.w;
			out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new int[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= n; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v, w;
    	public Edge(int v, int w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


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

public class C
{
	public static int[] dp;
	public static ArrayList<ArrayList<Edge>> g;
	public static int cnt = 0;
	public static void dfs(int u, int par, int minSoFar, int sumSoFar, boolean fail)
	{
		if(dp[u] < sumSoFar) {
			fail = true;
			cnt++;
			//out.println(u);
		}

		for(Edge i : g.get(u)) {
			int v = i.v, w = i.w;
			//out.println(u + " " + v + " " + w);
			if(v == par)
				continue;

			dfs(v, u, Math.min(minSoFar,  sumSoFar + w), sumSoFar + w, fail);
		}
	}

    public static void main(String[] args)
    {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int n;
        n = sc.nextInt();
        dp = new int[n + 1];

        for(int i = 1; i <= n; i++) {
        	dp[i] = sc.nextInt();
        }

        g = new ArrayList<ArrayList<Edge>>();
        for(int i = 0; i <= n; i++)
        	g.add(new ArrayList<Edge>());

        for(int i = 2; i <= 9; i++) {
        	int v = sc.nextInt(), w = sc.nextInt();
        	g.get(i).add(new Edge(v, w));
        	g.get(v).add(new Edge(i, w));
        }

        dfs(1, -1, 0, 0, false);
        out.println(cnt);
        out.close();
    }

    public static class Edge {
    	public int v, w;
    	public Edge(int v, int w) {
    		this.v = v;
    		this.w = w;
    	}
    }

    // PrintWriter for faster output
    public static PrintWriter out;

    // MyScanner class for faster input
    public static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;

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

        boolean hasNext()
        {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    return false;
                }
            }
            return true;
        }

        String next()
        {
            if (hasNext())
                return st.nextToken();
            return null;
        }

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

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

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

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


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class C {
	static class N implements Comparable<N> {
		int n;
		int cost;

		N(int i, int x) {
			this.n = i;
			this.cost = x;
		}

		@Override
		public int compareTo(N o) {
			return -Integer.compare(n, o.n);
		}
	}

	static LinkedList<N> tree[];
	static int a[];
	static int childs[];

	static int DFS(int p, N curr) {
		childs[curr.n] = 1;
		for (N x : tree[curr.n]) {
			if (x.n != p)
				childs[curr.n] += DFS(curr.n, x);
		}
		return childs[curr.n];
	}

	static int ans = 0;

	static void DFS(int p, N curr, long minSum, long currSum) {
		currSum += (long) curr.cost;
		if (currSum < 0)
			currSum = 0;
		minSum = Math.min(currSum, minSum);
		if (currSum - minSum > a[curr.n]) {
			ans += childs[curr.n];
			return;
		}
		for (N x : tree[curr.n]) {
			if (x.n != p)
				DFS(curr.n, x, minSum, currSum);
		}
	}

	public static void main(String[] args) throws Exception {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(bf.readLine());
		String l[] = bf.readLine().split(" ");
		a = new int[n];
		childs = new int[n];
		tree = new LinkedList[n];
		for (int i = 0; i < l.length; i++) {
			a[i] = Integer.parseInt(l[i]);
			tree[i] = new LinkedList<C.N>();
		}
		int a, c;
		for (int i = 1; i < n; i++) {
			l = bf.readLine().split(" ");
			a = Integer.parseInt(l[0]) - 1;
			c = Integer.parseInt(l[1]);
			tree[i].add(new N(a, c));
			tree[a].add(new N(i, c));
		}
		DFS(-1, new N(0, 0));
		DFS(-1, new N(0, 0), 0, 0);
		System.out.println(ans);
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class C {
	static class N implements Comparable<N> {
		int n;
		int cost;

		N(int i, int x) {
			this.n = i;
			this.cost = x;
		}

		@Override
		public int compareTo(N o) {
			return -Integer.compare(n, o.n);
		}
	}

	static LinkedList<N> tree[];
	static int a[];
	static int childs[];

	static int DFS(int p, N curr) {
		childs[curr.n] = 1;
		for (N x : tree[curr.n]) {
			if (x.n != p)
				childs[curr.n] += DFS(curr.n, x);
		}
		return childs[curr.n];
	}

	static int ans = 0;

	static void DFS(int p, N curr, long maxDist, long currSum) {
		currSum += (long) curr.cost;
		if (currSum < 0)
			currSum = 0;
		maxDist = Math.max(currSum, maxDist);
		if (maxDist > a[curr.n]) {
			ans += childs[curr.n];
			return;
		}
		for (N x : tree[curr.n]) {
			if (x.n != p)
				DFS(curr.n, x, maxDist, currSum);
		}
	}

	public static void main(String[] args) throws Exception {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(bf.readLine());
		String l[] = bf.readLine().split(" ");
		a = new int[n];
		childs = new int[n];
		tree = new LinkedList[n];
		for (int i = 0; i < l.length; i++) {
			a[i] = Integer.parseInt(l[i]);
			tree[i] = new LinkedList<C.N>();
		}
		int a, c;
		for (int i = 1; i < n; i++) {
			l = bf.readLine().split(" ");
			a = Integer.parseInt(l[0]) - 1;
			c = Integer.parseInt(l[1]);
			tree[i].add(new N(a, c));
			tree[a].add(new N(i, c));
		}
		DFS(-1, new N(0, 0));
		DFS(-1, new N(0, 0), 0, 0);
		System.out.println(ans);
	}
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------------------------------
		int n=in.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		ArrayList<ArrayList<Integer>> arr=new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Long>> cost=new ArrayList<ArrayList<Long>>();
		for(int i=0;i<=n;i++){
			arr.add(new ArrayList<Integer>());
			cost.add(new ArrayList<Long>());
		}
		for(int i=2;i<=n;i++){
			int p=in.nextInt();
			int c=in.nextInt();
			arr.get(i).add(p);
			cost.get(i).add((long)c);
			arr.get(p).add(i);
			cost.get(p).add((long)c);
		}

		//int count=0;
		boolean vis[]=new boolean[n+1];
		Queue<Pair> q=new LinkedList<>();
		Stack<Long> h=new Stack<Long>();
		q.add(new Pair(1,0));
		while(!q.isEmpty()){
			Pair rem=q.remove();
			if(vis[(int)rem.u]){
				continue;
			}
			//System.out.println(rem.u+" "+rem.v+" "+rem.flag+" "+a[(int)rem.u]);
			vis[(int)rem.u]=true;
			if((rem.v>a[(int)rem.u] || rem.flag)){
				//System.out.println(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),(rem.v<0?rem.v:0)+cost.get((int)rem.u).get(i));
						add.flag=true;
						q.add(add);
					}
				}
			}
			else{
				h.add(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),(rem.v<0?rem.v:0)+cost.get((int)rem.u).get(i));
						q.add(add);
					}
				}
			}
		}
		out.println(n-h.size());
		out.close();
		//---------------The End------------------

	}
	static class Pair implements Comparable<Pair> {
		 long u;
		 long v;
		boolean flag=false;
		public Pair(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------------------------------
		int n=in.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		ArrayList<ArrayList<Integer>> arr=new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Long>> cost=new ArrayList<ArrayList<Long>>();
		for(int i=0;i<=n;i++){
			arr.add(new ArrayList<Integer>());
			cost.add(new ArrayList<Long>());
		}
		for(int i=2;i<=n;i++){
			int p=in.nextInt();
			int c=in.nextInt();
			arr.get(i).add(p);
			cost.get(i).add((long)c);
			arr.get(p).add(i);
			cost.get(p).add((long)c);
		}

		//int count=0;
		boolean vis[]=new boolean[n+1];
		Queue<Pair> q=new LinkedList<>();
		Stack<Long> h=new Stack<Long>();
		q.add(new Pair(1,0));
		while(!q.isEmpty()){
			Pair rem=q.remove();
			if(vis[(int)rem.u]){
				continue;
			}
			//System.out.println(rem.u+" "+rem.v+" "+rem.flag+" "+a[(int)rem.u]);
			vis[(int)rem.u]=true;
			if((rem.v>a[(int)rem.u] || rem.flag)){
				//System.out.println(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						add.flag=true;
						q.add(add);
					}
				}
			}
			else{
				h.add(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						q.add(add);
					}
				}
			}
		}
		out.println(n-h.size());
		out.close();
		//---------------The End------------------

	}
	static class Pair implements Comparable<Pair> {
		final long u;
		final long v;
		boolean flag=false;
		public Pair(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------------------------------
		int n=in.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		ArrayList<ArrayList<Integer>> arr=new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Long>> cost=new ArrayList<ArrayList<Long>>();
		for(int i=0;i<=n;i++){
			arr.add(new ArrayList<Integer>());
			cost.add(new ArrayList<Long>());
		}
		for(int i=2;i<=n;i++){
			int p=in.nextInt();
			int c=in.nextInt();
			arr.get(i).add(p);
			cost.get(i).add((long)c);
			arr.get(p).add(i);
			cost.get(p).add((long)c);
		}

		//int count=0;
		boolean vis[]=new boolean[n+1];
		Queue<Pair> q=new LinkedList<>();
		Stack<Long> h=new Stack<Long>();
		q.add(new Pair(1,0));
		while(!q.isEmpty()){
			Pair rem=q.remove();
			if(vis[(int)rem.u]){
				continue;
			}
			//System.out.println(rem.u+" "+rem.v+" "+rem.flag+" "+a[(int)rem.u]);
			vis[(int)rem.u]=true;
			if((rem.v>a[(int)rem.u] || rem.flag)){
				//System.out.println(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),(rem.v>0?rem.v:0)+cost.get((int)rem.u).get(i));
						add.flag=true;
						q.add(add);
					}
				}
			}
			else{
				h.add(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),(rem.v>0?rem.v:0)+cost.get((int)rem.u).get(i));
						q.add(add);
					}
				}
			}
		}
		out.println(n-h.size());
		out.close();
		//---------------The End------------------

	}
	static class Pair implements Comparable<Pair> {
		 long u;
		 long v;
		boolean flag=false;
		public Pair(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------------------------------
		int n=in.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		ArrayList<ArrayList<Integer>> arr=new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Integer>> cost=new ArrayList<ArrayList<Integer>>();
		for(int i=0;i<=n;i++){
			arr.add(new ArrayList<Integer>());
			cost.add(new ArrayList<Integer>());
		}
		for(int i=2;i<=n;i++){
			int p=in.nextInt();
			int c=in.nextInt();
			arr.get(i).add(p);
			cost.get(i).add(c);
			arr.get(p).add(i);
			cost.get(p).add(c);
		}
		//int count=0;
		boolean vis[]=new boolean[n+1];
		Queue<Pair> q=new LinkedList<>();
		HashSet<Long> h=new HashSet<Long>();
		q.add(new Pair(1,0));
		while(!q.isEmpty()){
			Pair rem=q.remove();
			if(vis[(int)rem.u]){
				continue;
			}
			//System.out.println(rem.u+" "+rem.v+" "+rem.flag+" "+a[(int)rem.u]);
			vis[(int)rem.u]=true;
			if((rem.v>a[(int)rem.u] || rem.flag) && rem.u>1){
				//System.out.println(rem.u);
				h.add(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						add.flag=true;
						q.add(add);
					}
				}
			}
			else{
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						q.add(add);
					}
				}
			}
		}
		out.println(h.size());
		out.close();
		//---------------The End------------------

	}
	static class Pair implements Comparable<Pair> {
		final long u;
		final long v;
		boolean flag=false;
		public Pair(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------------------------------
		int n=in.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		ArrayList<ArrayList<Integer>> arr=new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Integer>> cost=new ArrayList<ArrayList<Integer>>();
		for(int i=0;i<=n;i++){
			arr.add(new ArrayList<Integer>());
			cost.add(new ArrayList<Integer>());
		}
		for(int i=2;i<=n;i++){
			int p=in.nextInt();
			int c=in.nextInt();
			arr.get(i).add(p);
			cost.get(i).add(c);
			arr.get(p).add(i);
			cost.get(p).add(c);
		}
		//int count=0;
		boolean vis[]=new boolean[n+1];
		Queue<Pair> q=new LinkedList<>();
		HashSet<Long> h=new HashSet<Long>();
		q.add(new Pair(1,0));
		while(!q.isEmpty()){
			Pair rem=q.remove();
			if(vis[(int)rem.u]){
				continue;
			}
			//System.out.println(rem.u+" "+rem.v+" "+rem.flag+" "+a[(int)rem.u]);
			vis[(int)rem.u]=true;
			if(rem.v>a[(int)rem.u] || rem.flag){
				//System.out.println(rem.u);
				h.add(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						add.flag=true;
						q.add(add);
					}
				}
			}
			else{
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						q.add(add);
					}
				}
			}
		}
		out.println(h.size());
		out.close();
		//---------------The End------------------

	}
	static class Pair implements Comparable<Pair> {
		final long u;
		final long v;
		boolean flag=false;
		public Pair(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


/*
 * Code Author: Akshay Miterani
 * DA-IICT
 */
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {

	static double eps=(double)1e-7;
	static long mod=(int)1e9+7;
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		//---------------------------------------
		int n=in.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		ArrayList<ArrayList<Integer>> arr=new ArrayList<ArrayList<Integer>>();
		ArrayList<ArrayList<Long>> cost=new ArrayList<ArrayList<Long>>();
		for(int i=0;i<=n;i++){
			arr.add(new ArrayList<Integer>());
			cost.add(new ArrayList<Long>());
		}
		for(int i=2;i<=n;i++){
			int p=in.nextInt();
			int c=in.nextInt();
			arr.get(i).add(p);
			cost.get(i).add((long)c);
			arr.get(p).add(i);
			cost.get(p).add((long)c);
		}
		if(a[1]<0){
			System.out.println(n);
			return;
		}
		//int count=0;
		boolean vis[]=new boolean[n+1];
		Queue<Pair> q=new LinkedList<>();
		HashSet<Long> h=new HashSet<Long>();
		q.add(new Pair(1,0));
		while(!q.isEmpty()){
			Pair rem=q.remove();
			if(vis[(int)rem.u]){
				continue;
			}
			//System.out.println(rem.u+" "+rem.v+" "+rem.flag+" "+a[(int)rem.u]);
			vis[(int)rem.u]=true;
			if((rem.v>a[(int)rem.u] || rem.flag) && rem.u>1){
				//System.out.println(rem.u);
				h.add(rem.u);
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						add.flag=true;
						q.add(add);
					}
				}
			}
			else{
				for(int i=0;i<arr.get((int)rem.u).size();i++){
					if(!vis[arr.get((int)rem.u).get(i)]){
						Pair add=new Pair(arr.get((int)rem.u).get(i),rem.v+cost.get((int)rem.u).get(i));
						q.add(add);
					}
				}
			}
		}
		out.println(h.size());
		out.close();
		//---------------The End------------------

	}
	static class Pair implements Comparable<Pair> {
		final long u;
		final long v;
		boolean flag=false;
		public Pair(long u, long v) {
			this.u = u;
			this.v = v;
		}

		public int hashCode() {
			int hu = (int) (u ^ (u >>> 32));
			int hv = (int) (v ^ (v >>> 32));
			return 31 * hu + hv;
		}

		public boolean equals(Object o) {
			Pair other = (Pair) o;
			return u == other.u && v == other.v;
		}

		public int compareTo(Pair other) {
			return Long.compare(u, other.u) != 0 ? Long.compare(u, other.u) : Long.compare(v, other.v);
		}

		public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}
	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static long gcd(long x, long y)
	{
		if(x==0)
			return y;
		if(y==0)
			return x;
		long r=0, a, b;
		a = (x > y) ? x : y; // a is greater number
		b = (x < y) ? x : y; // b is smaller number
		r = b;
		while(a % b != 0)
		{
			r = a % b;
			a = b;
			b = r;
		}
		return r;
	}

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

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

		public String nextLine(){
			String fullLine=null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine=reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}
}


import java.io.*;
import java.util.*;
public class C682
{
    int id,wt;
    static int cou[],arr[];static long dist[];static boolean vis[];
    static HashSet<Integer> set=new HashSet<>();
    static HashMap<Integer,ArrayList<C682>> map=new HashMap<>();
    //static List<Integer> neg=new ArrayList<>();

    public C682(int i,int w)
    {
        this.id=i;
        this.wt=w;
    }
    static int dfs(int ind,int par,int w)
    {
        vis[ind]=true;
        dist[ind]=dist[par]+w;
        if(dist[ind]>=0)
        {
            if(dist[ind]>arr[ind])
                set.add(ind);
        }
        else
        {
            //neg.add(ind);
            dist[ind]=0;
        }
        int c=1;
        for(C682 ob:map.get(ind))
        {
            if(!vis[ob.id])
            {
                c+=dfs(ob.id,ind,ob.wt);
            }
        }
        cou[ind]=c;
        return c;
    }
    public static void main(String args[])throws IOException
    {
        Reader sc=new Reader();
        int n=sc.nextInt();
        arr=new int[n+1];
        //neg.add(1);
        //int par[]=new int[n+1];
        //HashMap<Integer,ArrayList<C682>> map=new HashMap<>();
        for(int i=1;i<=n;i++)
        {
            arr[i]=sc.nextInt();
            map.put(i,new ArrayList<>());
        }
        for(int i=1;i<n;i++)
        {
            int x=sc.nextInt();
            int w=sc.nextInt();
            map.get(i+1).add(new C682(x,w));
            map.get(x).add(new C682(i+1,w));
        }
        cou=new int[n+1];
        dist=new long[n+1];
        vis=new boolean[n+1];
        dfs(1,0,0);
        vis=new boolean[n+1];
        for(int i:set)
        {
            vis[i]=true;
        }
        int q[]=new int[n+1];
        q[0]=1;int back=0,front=1;
        vis[1]=true;int c=0;
        while(back!=front)
        {
            int a=q[back];back++;c++;
            //System.out.println(a);
            for(C682 ob:map.get(a))
            {
                if(!vis[ob.id])
                {
                    q[front++]=ob.id;
                    vis[ob.id]=true;
                }
            }
        }
        System.out.println(n-c);
    }
}
//import java.io.*;
class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte [] buffer;
		private int bufferPointer, bytesRead;

		public Reader () {
			din = new DataInputStream (System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader (String file_name) throws IOException {
			din = new DataInputStream (new FileInputStream (file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine () throws IOException {
			byte [] buf = new byte[1024];
			int cnt = 0, c;
			while ((c = read ()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String (buf, 0, cnt);
		}

		public int nextInt () throws IOException {
			int ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong () throws IOException {
			long ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble () throws IOException {
			double ret = 0, div = 1;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read ()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer () throws IOException {
			bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read () throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer ();
			return buffer[bufferPointer++];
		}

		public void close () throws IOException {
			if (din == null)
				return;
			din.close ();
		}
	}


import java.io.*;
import java.util.*;
public class C682
{
    int id,wt;
    static int cou[],arr[];static long dist[];static boolean vis[];
    static HashSet<Integer> set=new HashSet<>();
    static HashMap<Integer,ArrayList<C682>> map=new HashMap<>();
    static List<Integer> neg=new ArrayList<>();

    public C682(int i,int w)
    {
        this.id=i;
        this.wt=w;
    }
    static int dfs(int ind,int par,int w)
    {
        vis[ind]=true;
        dist[ind]=dist[par]+w;
        if(dist[ind]>=0)
        {
            if(dist[ind]>arr[ind])
                set.add(ind);
        }
        else
        {
            neg.add(ind);
            dist[ind]=0;
        }
        int c=1;
        for(C682 ob:map.get(ind))
        {
            if(!vis[ob.id])
            {
                c+=dfs(ob.id,ind,ob.wt);
            }
        }
        cou[ind]=c;
        return c;
    }
    public static void main(String args[])throws IOException
    {
        Reader sc=new Reader();
        int n=sc.nextInt();
        arr=new int[n+1];
        neg.add(1);
        //HashMap<Integer,ArrayList<C682>> map=new HashMap<>();
        for(int i=1;i<=n;i++)
        {
            arr[i]=sc.nextInt();
            map.put(i,new ArrayList<>());
        }
        for(int i=1;i<n;i++)
        {
            int x=sc.nextInt();
            int w=sc.nextInt();
            map.get(i+1).add(new C682(x,w));
            map.get(x).add(new C682(i+1,w));
        }
        cou=new int[n+1];
        dist=new long[n+1];
        vis=new boolean[n+1];
        dfs(1,0,0);
        int v[]=new int[n+1];
        int res=0;
        //System.out.println(set+" "+neg);
        /*for(int i=1;i<=n;i++)
        {
            System.out.println(dist[i]+" "+cou[i]);
        }*/
        for(int i:neg)
        {
            Queue<Integer> q=new LinkedList<>();
            q.add(i);v[i]=1;
            //int res=0;
            while(q.size()!=0)
            {
                int a=(Integer)q.poll();
                for(C682 ob:map.get(a))
                {
                    if(v[ob.id]==0 && !neg.contains(ob.id) && v[a]!=2)
                    {
                        if(set.contains(ob.id))
                        {
                            //System.out.println(i+" "+ob.id+" "+cou[ob.id]);
                            res+=cou[ob.id];
                            q.add(ob.id);
                            v[ob.id]=2;
                        }

                        else
                        {
                            q.add(ob.id);
                            v[ob.id]=1;
                        }
                    }
                    else if(v[a]==2 && v[ob.id]==0)
                    {
                        q.add(ob.id);
                        v[ob.id]=2;
                    }
                }
            }
        }
        System.out.println(res);
    }

}
//import java.io.*;
class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte [] buffer;
		private int bufferPointer, bytesRead;

		public Reader () {
			din = new DataInputStream (System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader (String file_name) throws IOException {
			din = new DataInputStream (new FileInputStream (file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine () throws IOException {
			byte [] buf = new byte[1024];
			int cnt = 0, c;
			while ((c = read ()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String (buf, 0, cnt);
		}

		public int nextInt () throws IOException {
			int ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong () throws IOException {
			long ret = 0;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble () throws IOException {
			double ret = 0, div = 1;
			byte c = read ();
			while (c <= ' ')
				c = read ();
			boolean neg = (c == '-');
			if (neg)
				c = read ();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read ()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read ()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer () throws IOException {
			bytesRead = din.read (buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read () throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer ();
			return buffer[bufferPointer++];
		}

		public void close () throws IOException {
			if (din == null)
				return;
			din.close ();
		}
	}


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

public class C extends cf {
    public static void main(String[] args) {C c=new C();}
    public void run(InputReader in, PrintWriter out) {
        int n=in.nextInt(),ans=0;
        int[] a=new int[n+1],d=new int[n+1];
        int[][] w=new int[n+1][n+1];
        List<List<Integer>> g=new ArrayList<List<Integer>>();
        for (int i=1;i<=n;i++) {
            a[i]=in.nextInt();
        }
        for (int i=0;i<=n;i++) {
            g.add(new ArrayList<Integer>());
        }
        for (int i=2;i<=n;i++) {
            int p=in.nextInt(),c=in.nextInt();
            g.get(i).add(p);
            g.get(p).add(i);
            w[i][p]=c;
            w[p][i]=c;
        }
        boolean[] m=new boolean[n+1],mkd=new boolean[n+1];
        Deque<Integer> st=new ArrayDeque<Integer>();
        st.addFirst(1);
        mkd[1]=true;
        while (!st.isEmpty()) {
            int v=st.pollFirst();
            for (int u:g.get(v)) {
                if (!mkd[u]) {
                    mkd[u]=true;
                    int newd=d[v]+w[v][u];
                    if (m[v]) {
                        m[u]=true;
                        ans++;
                    }
                    else if (a[u]>=newd) {
                        d[u]=Math.max(0,newd);
                    }
                    else {
                        m[u]=true;
                        ans++;
                    }
                    st.addFirst(u);
                }
            }
        }
        out.print(ans);
    }
}

class cf {
    public cf() {
        try {
            InputStream inputStream=System.in;
            OutputStream outputStream=System.out;
            //InputStream inputStream=new FileInputStream("file.in");
            //OutputStream outputStream=new FileOutputStream("file.out");
            InputReader in=new InputReader(inputStream);
            PrintWriter out=new PrintWriter(outputStream);
            run(in,out);
            out.close();
        } catch (Exception e) {
            if (e instanceof FileNotFoundException) {System.out.print("File not found.");}
            else {e.printStackTrace();}
        }
    }

    public void run(InputReader in,PrintWriter out) {}
}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream stream) {
        br=new BufferedReader(new InputStreamReader(stream),32768);
        st=null;
    }
    public String next() {
        while (st==null||!st.hasMoreTokens()) {
            try {
                st=new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    public int nextInt() {return Integer.parseInt(next());}
    public long nextLong() {return Long.parseLong(next());}
    public double nextDouble() {return Double.parseDouble(next());}
    public int[] nextIntArray(int n) {
        int[] a=new int[n];
        for (int i=0;i<n;i++) {a[i]=nextInt();}
        return a;
    }
    public long[] nextLongArray(int n) {
        long[] a=new long[n];
        for (int i=0;i<n;i++) {a[i]=nextLong();}
        return a;
    }
}


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

public class C extends cf {
    public static void main(String[] args) {C c=new C();}
    public void run(InputReader in, PrintWriter out) {
        int n=in.nextInt(),ans=0,v,p,c,newd;
        int[] a=new int[n+1],d=new int[n+1];
        List<Map<Integer,Integer>> w=new ArrayList<Map<Integer,Integer>>();
        List<List<Integer>> g=new ArrayList<List<Integer>>();
        for (int i=1;i<=n;i++) {
            a[i]=in.nextInt();
        }
        for (int i=0;i<=n;i++) {
            g.add(new ArrayList<Integer>());
            w.add(new HashMap<Integer,Integer>());
        }
        for (int i=2;i<=n;i++) {
            p=in.nextInt();
            c=in.nextInt();
            g.get(i).add(p);
            g.get(p).add(i);
            w.get(i).put(p,c);
            w.get(p).put(i,c);
        }
        boolean[] m=new boolean[n+1],mkd=new boolean[n+1];
        Deque<Integer> st=new ArrayDeque<Integer>();
        st.addFirst(1);
        mkd[1]=true;
        while (!st.isEmpty()) {
            v=st.pollFirst();
            for (int u:g.get(v)) {
                if (!mkd[u]) {
                    mkd[u]=true;
                    newd=d[v]+w.get(v).get(u);
                    if (m[v]) {
                        m[u]=true;
                        ans++;
                    }
                    else if (a[u]>=newd) {
                        d[u]=Math.max(0,newd);
                    }
                    else {
                        m[u]=true;
                        ans++;
                    }
                    st.addFirst(u);
                }
            }
        }
        out.print(ans);
    }
}

class cf {
    public cf() {
        try {
            InputStream inputStream=System.in;
            OutputStream outputStream=System.out;
            //InputStream inputStream=new FileInputStream("file.in");
            //OutputStream outputStream=new FileOutputStream("file.out");
            InputReader in=new InputReader(inputStream);
            PrintWriter out=new PrintWriter(outputStream);
            run(in,out);
            out.close();
        } catch (Exception e) {
            if (e instanceof FileNotFoundException) {System.out.print("File not found.");}
            else {e.printStackTrace();}
        }
    }

    public void run(InputReader in,PrintWriter out) {}
}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream stream) {
        br=new BufferedReader(new InputStreamReader(stream),32768);
        st=null;
    }
    public String next() {
        while (st==null||!st.hasMoreTokens()) {
            try {
                st=new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    public int nextInt() {return Integer.parseInt(next());}
    public long nextLong() {return Long.parseLong(next());}
    public double nextDouble() {return Double.parseDouble(next());}
    public int[] nextIntArray(int n) {
        int[] a=new int[n];
        for (int i=0;i<n;i++) {a[i]=nextInt();}
        return a;
    }
    public long[] nextLongArray(int n) {
        long[] a=new long[n];
        for (int i=0;i<n;i++) {a[i]=nextLong();}
        return a;
    }
}


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

public class C extends cf {
    public static void main(String[] args) {C c=new C();}
    public void run(InputReader in, PrintWriter out) {
        int n=in.nextInt(),ans=0,v,p,c,newd;
        int[] a=new int[n+1],d=new int[n+1];
        int[][] w=new int[n+1][n+1];
        List<List<Integer>> g=new ArrayList<List<Integer>>();
        for (int i=1;i<=n;i++) {
            a[i]=in.nextInt();
        }
        for (int i=0;i<=n;i++) {
            g.add(new ArrayList<Integer>());
        }
        for (int i=2;i<=n;i++) {
            p=in.nextInt();
            c=in.nextInt();
            g.get(i).add(p);
            g.get(p).add(i);
            w[i][p]=c;
            w[p][i]=c;
        }
        boolean[] m=new boolean[n+1],mkd=new boolean[n+1];
        Deque<Integer> st=new ArrayDeque<Integer>();
        st.addFirst(1);
        mkd[1]=true;
        while (!st.isEmpty()) {
            v=st.pollFirst();
            for (int u:g.get(v)) {
                if (!mkd[u]) {
                    mkd[u]=true;
                    newd=d[v]+w[v][u];
                    if (m[v]) {
                        m[u]=true;
                        ans++;
                    }
                    else if (a[u]>=newd) {
                        d[u]=Math.max(0,newd);
                    }
                    else {
                        m[u]=true;
                        ans++;
                    }
                    st.addFirst(u);
                }
            }
        }
        out.print(ans);
    }
}

class cf {
    public cf() {
        try {
            InputStream inputStream=System.in;
            OutputStream outputStream=System.out;
            //InputStream inputStream=new FileInputStream("file.in");
            //OutputStream outputStream=new FileOutputStream("file.out");
            InputReader in=new InputReader(inputStream);
            PrintWriter out=new PrintWriter(outputStream);
            run(in,out);
            out.close();
        } catch (Exception e) {
            if (e instanceof FileNotFoundException) {System.out.print("File not found.");}
            else {e.printStackTrace();}
        }
    }

    public void run(InputReader in,PrintWriter out) {}
}

class InputReader {
    private BufferedReader br;
    private StringTokenizer st;
    public InputReader(InputStream stream) {
        br=new BufferedReader(new InputStreamReader(stream),32768);
        st=null;
    }
    public String next() {
        while (st==null||!st.hasMoreTokens()) {
            try {
                st=new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }
    public int nextInt() {return Integer.parseInt(next());}
    public long nextLong() {return Long.parseLong(next());}
    public double nextDouble() {return Double.parseDouble(next());}
    public int[] nextIntArray(int n) {
        int[] a=new int[n];
        for (int i=0;i<n;i++) {a[i]=nextInt();}
        return a;
    }
    public long[] nextLongArray(int n) {
        long[] a=new long[n];
        for (int i=0;i<n;i++) {a[i]=nextLong();}
        return a;
    }
}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class AlyonaandtheTree {

	static int V;
	static long val[];
	static ArrayList<Point>[] adjList;

	static int solve(int u, int parent, long dist, boolean rem){
		if(rem){
			int ans = 1;

			for (int i = 0; i < adjList[u].size(); i++) {
				Point cur = adjList[u].get(i);
				if(cur.x != parent)
					ans += solve(cur.x, u, -1,  true);
			}
			return ans;
		}else{
			int ans = 0;

			for (int i = 0; i < adjList[u].size(); i++) {
				Point cur = adjList[u].get(i);
				if(cur.x != parent && val[cur.x] < dist + cur.y)
					ans += solve(cur.x, u, -1,  true);
				else if(cur.x != parent)
					ans += solve(cur.x, u, dist + cur.y,  false);
			}
			return ans;
		}
	}

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

		V = sc.nextInt();
		val = new long[V];

		adjList = new ArrayList[V];

		for (int i = 0; i < V; i++){
			val[i] = sc.nextLong();
			adjList[i] = new ArrayList<>();
		}

		for (int i = 1; i < V; i++)
			adjList[sc.nextInt() - 1].add(new Point(i, sc.nextInt()));

		out.println(solve(0, -1, 0, false));

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

	}

	static class Scanner

	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}

}


import java.awt.Point;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class AlyonaandtheTree {

	static int V;
	static long val[];
	static ArrayList<Point>[] adjList;

	static int solve(int u, int parent, long dist, boolean rem){
		if(rem){
			int ans = 1;

			for (int i = 0; i < adjList[u].size(); i++) {
				Point cur = adjList[u].get(i);
				if(cur.x != parent)
					ans += solve(cur.x, u, -1,  true);
			}
			return ans;
		}else{
			int ans = 0;

			for (int i = 0; i < adjList[u].size(); i++) {
				Point cur = adjList[u].get(i);
				if(cur.x != parent && val[cur.x] < dist + cur.y)
					ans += solve(cur.x, u, -1,  true);
				else if(cur.x != parent)
					ans += solve(cur.x, u, Math.max(0, dist + cur.y),  false);
			}
			return ans;
		}
	}

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

		V = sc.nextInt();
		val = new long[V];

		adjList = new ArrayList[V];

		for (int i = 0; i < V; i++){
			val[i] = sc.nextLong();
			adjList[i] = new ArrayList<>();
		}

		for (int i = 1; i < V; i++)
			adjList[sc.nextInt() - 1].add(new Point(i, sc.nextInt()));

		out.println(solve(0, -1, 0, false));

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

	}

	static class Scanner

	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

/**
 * Created by yujiahao on 9/14/16.
 */
public class cf_358_c {
    private FastScanner in;
    private PrintWriter out;

    public void solve() throws IOException {
        int n = in.nextInt();
        long[] a = new long[n];
        for (int i=0; i<n; i++) a[i] = in.nextLong();
        ArrayList<ArrayList<pair_358>> graph = new ArrayList<ArrayList<pair_358>>();
        for (int i=0; i<n; i++) graph.add(new ArrayList<pair_358>());
        for (int i=1; i<=n-1; i++){
            int p = in.nextInt()-1;
            long c = in.nextInt();
            pair_358 cur1 = new pair_358(p, c);
            graph.get(i).add(cur1);
            pair_358 cur2 = new pair_358(i, c);
            graph.get(p).add(cur2);
        }

        int[] res = {0};
        long[] min = {Integer.MAX_VALUE};

        dfs(0, graph, res, 0L, min, a, -1);
        out.print(n-res[0]);
    }

    void dfs(int idx, ArrayList<ArrayList<pair_358>> graph, int[] res, long dis, long[] min, long[] a, int pre){
        long curA = a[idx];
        if (dis<0)  dis = 0;
        if (dis - min[0] > curA)    return;
        min[0] = Math.min(min[0], dis);

        res[0]++;

        ArrayList<pair_358> neighbors = graph.get(idx);
        for (pair_358 next : neighbors){
            int nextP = next.p;
            long nextC = next.c;
            if (nextP == pre)   continue;
            dfs(nextP, graph, res, dis+nextC, min, a, idx);
        }
        return;
    }

    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());
        }

        public BigInteger nextBigInteger() { return new BigInteger(next());}

    }

    public static void main(String[] arg) {
        new cf_358_c().run();
    }
}

class pair_358 {
    int p ;
    long c ;
    public pair_358(int p, long c){
        this.p = p;
        this.c = c;
    }
}