import java.util.Scanner;

public class Main{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	}
	
	public static boolean Search(int[] list, int n)
	{
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	}
}

 import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	}
	
	public static boolean Search(int[] list, int n)
	{
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	}
} Main public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	} main {
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int length = in.nextInt(); length in.nextInt() in.nextInt in int[] string = new int[length]; string new int[length] length for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
			string[i] = in.nextInt();
		} {
			string[i] = in.nextInt();
		} string[i] = in.nextInt() string[i] string i in.nextInt() in.nextInt in length = in.nextInt() length in.nextInt() in.nextInt in int[] search = new int[length]; search new int[length] length for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
			search[i] = in.nextInt();
		} {
			search[i] = in.nextInt();
		} search[i] = in.nextInt() search[i] search i in.nextInt() in.nextInt in int count = 0; count 0 for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		} int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
			if(Search(string, search[i]))
			{
				count++;
			}
		} {
			if(Search(string, search[i]))
			{
				count++;
			}
		} if(Search(string, search[i]))
			{
				count++;
			} Search(string, search[i]) Search string search[i] search i {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static boolean Search(int[] list, int n)
	{
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	} Search {
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	} int start = 0; start 0 int end = list.length - 1; end list.length - 1 list.length list list.length 1 while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		} start <= end start end {
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		} int mid = ((start + end) / 2); mid ((start + end) / 2) (start + end) start end 2 if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			} list[mid] == n list[mid] list mid n {
				return true;
			} return true; true if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			} list[mid] > n list[mid] list mid n {
				end = mid - 1;
			} end = mid - 1 end mid - 1 mid 1 {
				start = mid + 1;
			} start = mid + 1 start mid + 1 mid 1 return false; false int[] list list int n n public class Main{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	}
	
	public static boolean Search(int[] list, int n)
	{
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	}
} public class Main{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	}
	
	public static boolean Search(int[] list, int n)
	{
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int length = in.nextInt();
		int[] string = new int[length];
		for(int i = 0; i < length; i++)
		{
			string[i] = in.nextInt();
		}
		
		length = in.nextInt();
		int[] search = new int[length];
		for(int i = 0; i < length; i++)
		{
			search[i] = in.nextInt();
		}
		
		int count = 0;
		for(int i = 0; i < length; i++)
		{
			if(Search(string, search[i]))
			{
				count++;
			}
		}
		System.out.println(count);
	}
	
	public static boolean Search(int[] list, int n)
	{
		int start = 0;
		int end = list.length - 1;
		while(start <= end)
		{
			int mid = ((start + end) / 2);
		
			if(list[mid] == n)
			{
				return true;
			} else if (list[mid] > n) {
				end = mid - 1;
			}else {
				start = mid + 1;
			}
		}
		
		return false;
	}
}


