
import java.util.Scanner;

public class Main {

	public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	}

	public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {

	public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	}

	public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	}
} Main public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	} callBinarySearch {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	} int output = 0; output 0 for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		} int j = 0 ; int j = 0 ; j 0 j < second.length j second.length second second.length j++ j++ j {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		} {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		} if(binarySearch(first,second[j]) == 1) {
				output++;
			} binarySearch(first,second[j]) == 1 binarySearch(first,second[j]) binarySearch first second[j] second j 1 {
				output++;
			} output++ output return output; output int[] first first int[] second second public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	} binarySearch {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	} int left = 0; left 0 int right = array.length-1; right array.length-1 array.length array array.length 1 int mid ; mid while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		} left <= right left right {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		} mid = (left+right)/2 mid (left+right)/2 (left+right) left right 2 if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			} array[mid] == x array[mid] array mid x {
				return 1;
			} return 1; 1 if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			} array[mid] > x array[mid] array mid x {
				right = mid-1;
			} right = mid-1 right mid-1 mid 1 {
				left = mid+1;
			} left = mid+1 left mid+1 mid 1 return 0; 0 int[] array array int x x public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	} toArray {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	} Scanner in = new Scanner(s); in new Scanner(s) int[] output = new int[l]; output new int[l] l for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
			output[i] = in.nextInt();
		} {
			output[i] = in.nextInt();
		} output[i] = in.nextInt() output[i] output i in.nextInt() in.nextInt in in.close() in.close in return output; output String s s int l l public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	} main {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int lengthOne lengthOne lengthTwo; lengthTwo String arrayOne arrayOne arrayTwo; arrayTwo lengthOne = in.nextInt() lengthOne in.nextInt() in.nextInt in in.nextLine() in.nextLine in arrayOne = in.nextLine() arrayOne in.nextLine() in.nextLine in lengthTwo = in.nextInt() lengthTwo in.nextInt() in.nextInt in in.nextLine() in.nextLine in arrayTwo = in.nextLine() arrayTwo in.nextLine() in.nextLine in int[] first = toArray(arrayOne, lengthOne); first toArray(arrayOne, lengthOne) toArray arrayOne lengthOne int[] second = toArray(arrayTwo, lengthTwo); second toArray(arrayTwo, lengthTwo) toArray arrayTwo lengthTwo System.out.println(callBinarySearch(first, second)) System.out.println System.out System System.out callBinarySearch(first, second) callBinarySearch first second in.close() in.close in String[] args args public class Main {

	public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	}

	public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	}
} public class Main {

	public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	}

	public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	}
} Main

import java.util.Scanner;

public class Main {

	public static int callBinarySearch(int[] first, int[] second) {
		int output = 0;

		for(int j = 0 ;j < second.length;j++) {
			if(binarySearch(first,second[j]) == 1) {
				output++;
			}
		}
		return output;
	}

	public static int binarySearch(int[] array, int x) {
		
		int left = 0;
		int right = array.length-1;
		int mid ;
		while(left <= right) {
			mid = (left+right)/2;
			if(array[mid] == x) {
				return 1;
			}else if(array[mid] > x) {
				right = mid-1;
			}else {
				left = mid+1;
			}
		}
		return 0;
	}

	public static int[] toArray(String s, int l) {
		Scanner in = new Scanner(s);
		int[] output = new int[l];
		for (int i = 0; i < l; i++) {
			output[i] = in.nextInt();
		}
		in.close();
		return output;
	}

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);

		int lengthOne, lengthTwo;
		String arrayOne, arrayTwo;

		lengthOne = in.nextInt();
		in.nextLine();
		arrayOne = in.nextLine();

		lengthTwo = in.nextInt();
		in.nextLine();
		arrayTwo = in.nextLine();

		int[] first = toArray(arrayOne, lengthOne);
		int[] second = toArray(arrayTwo, lengthTwo);
		System.out.println(callBinarySearch(first, second));
		

		in.close();
	}
}

