import java.util.Scanner;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int answer = 0;
		int n = Integer.parseInt(scanner.nextLine());
		int[] data1 = new int[n];
		for(int i = 0; i < n; i++){
			data1[i] = scanner.nextInt();
		}
		String nothing = scanner.nextLine();

		int q = Integer.parseInt(scanner.nextLine());
		int[] data2 = new int[q];
		for(int i = 0; i < q; i++){
			data2[i] = scanner.nextInt();
		}

		for(int i = 0; i < q; i++){
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		}
		
		System.out.println(answer);

	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Deque; Deque java.util import java.util.ArrayDeque; ArrayDeque java.util class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int answer = 0;
		int n = Integer.parseInt(scanner.nextLine());
		int[] data1 = new int[n];
		for(int i = 0; i < n; i++){
			data1[i] = scanner.nextInt();
		}
		String nothing = scanner.nextLine();

		int q = Integer.parseInt(scanner.nextLine());
		int[] data2 = new int[q];
		for(int i = 0; i < q; i++){
			data2[i] = scanner.nextInt();
		}

		for(int i = 0; i < q; i++){
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		}
		
		System.out.println(answer);

	}
} Main public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int answer = 0;
		int n = Integer.parseInt(scanner.nextLine());
		int[] data1 = new int[n];
		for(int i = 0; i < n; i++){
			data1[i] = scanner.nextInt();
		}
		String nothing = scanner.nextLine();

		int q = Integer.parseInt(scanner.nextLine());
		int[] data2 = new int[q];
		for(int i = 0; i < q; i++){
			data2[i] = scanner.nextInt();
		}

		for(int i = 0; i < q; i++){
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		}
		
		System.out.println(answer);

	} main {
		Scanner scanner = new Scanner(System.in);
		int answer = 0;
		int n = Integer.parseInt(scanner.nextLine());
		int[] data1 = new int[n];
		for(int i = 0; i < n; i++){
			data1[i] = scanner.nextInt();
		}
		String nothing = scanner.nextLine();

		int q = Integer.parseInt(scanner.nextLine());
		int[] data2 = new int[q];
		for(int i = 0; i < q; i++){
			data2[i] = scanner.nextInt();
		}

		for(int i = 0; i < q; i++){
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		}
		
		System.out.println(answer);

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int answer = 0; answer 0 int n = Integer.parseInt(scanner.nextLine()); n Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner int[] data1 = new int[n]; data1 new int[n] n for(int i = 0; i < n; i++){
			data1[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			data1[i] = scanner.nextInt();
		} {
			data1[i] = scanner.nextInt();
		} data1[i] = scanner.nextInt() data1[i] data1 i scanner.nextInt() scanner.nextInt scanner String nothing = scanner.nextLine(); nothing scanner.nextLine() scanner.nextLine scanner int q = Integer.parseInt(scanner.nextLine()); q Integer.parseInt(scanner.nextLine()) Integer.parseInt Integer scanner.nextLine() scanner.nextLine scanner int[] data2 = new int[q]; data2 new int[q] q for(int i = 0; i < q; i++){
			data2[i] = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			data2[i] = scanner.nextInt();
		} {
			data2[i] = scanner.nextInt();
		} data2[i] = scanner.nextInt() data2[i] data2 i scanner.nextInt() scanner.nextInt scanner for(int i = 0; i < q; i++){
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		} {
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		} int left = 0; left 0 int right = n; right n int middle = 0; middle 0 while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			} left < right left right {
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			} middle = (left + right) / 2 middle (left + right) / 2 (left + right) left right 2 if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				} data1[middle] == data2[i] data1[middle] data1 middle data2[i] data2 i {
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				} answer ++ answer break; if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				} data1[middle] > data2[i] data1[middle] data1 middle data2[i] data2 i {
					right = middle;
				} right = middle right middle {
					left = middle+1;
				} left = middle+1 left middle+1 middle 1 System.out.println(answer) System.out.println System.out System System.out answer String[] args args
import java.util.Scanner;
import java.util.Arrays;
import java.util.Deque;
import java.util.ArrayDeque;

class Main{
	public static void main(String[] args){
		Scanner scanner = new Scanner(System.in);
		int answer = 0;
		int n = Integer.parseInt(scanner.nextLine());
		int[] data1 = new int[n];
		for(int i = 0; i < n; i++){
			data1[i] = scanner.nextInt();
		}
		String nothing = scanner.nextLine();

		int q = Integer.parseInt(scanner.nextLine());
		int[] data2 = new int[q];
		for(int i = 0; i < q; i++){
			data2[i] = scanner.nextInt();
		}

		for(int i = 0; i < q; i++){
		    int left = 0;
    		int right = n;
    		int middle = 0;
			while(left < right){
				middle = (left + right) / 2;

				if(data1[middle] == data2[i]){
					answer ++;
				// 	System.out.println(data2[i]);
					break;
				}else if(data1[middle] > data2[i]){
					right = middle;
				}else{
					left = middle+1;
				}
			}
		}
		
		System.out.println(answer);

	}
}