

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	}
}
 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr1 = new int[n]; arr1 new int[n] n for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<arr1.length i arr1.length arr1 arr1.length i++ i++ i {
			arr1[i]=sc.nextInt();
		} {
			arr1[i]=sc.nextInt();
		} arr1[i]=sc.nextInt() arr1[i] arr1 i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] arr2 = new int[q]; arr2 new int[q] q for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		} int i=0; int i=0; i 0 i<arr2.length i arr2.length arr2 arr2.length i++ i++ i {
			arr2[i]=sc.nextInt();
		} {
			arr2[i]=sc.nextInt();
		} arr2[i]=sc.nextInt() arr2[i] arr2 i sc.nextInt() sc.nextInt sc int sum=0; sum 0 Arrays.sort(arr1) Arrays.sort Arrays arr1 Arrays.sort(arr2) Arrays.sort Arrays arr2 for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		} int i=0; int i=0; i 0 i<arr2.length i arr2.length arr2 arr2.length i++ i++ i {
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		} {
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		} if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			} Arrays.binarySearch(arr1, arr2[i])>-1 Arrays.binarySearch(arr1, arr2[i]) Arrays.binarySearch Arrays arr1 arr2[i] arr2 i -1 1 {
				sum++;
			} sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	}
} Main


import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //n个
		int[] arr1 = new int[n];
		for(int i=0;i<arr1.length;i++)
		{
			arr1[i]=sc.nextInt();
		}
		int q = sc.nextInt(); //q
		int[] arr2 = new int[q]; //不重复的
		for(int i=0;i<arr2.length;i++)
		{
			arr2[i]=sc.nextInt();
		}
		int sum=0;
		
		
		
		Arrays.sort(arr1);
		Arrays.sort(arr2);
		
		for(int i=0;i<arr2.length;i++)
		{
			if(Arrays.binarySearch(arr1, arr2[i])>-1)
			{
				sum++;
			}
		}
		
		System.out.println(sum);
	}
}

