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();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

    	sc.close();
	}
} 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();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

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

		int n = sc.nextInt();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

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

		int n = sc.nextInt();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

    	sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
    		s[i] = sc.nextInt();
    	} {
    		s[i] = sc.nextInt();
    	} s[i] = sc.nextInt() s[i] s i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
    		t[i] = sc.nextInt();
    	} {
    		t[i] = sc.nextInt();
    	} t[i] = sc.nextInt() t[i] t i sc.nextInt() sc.nextInt sc Arrays.sort(s) Arrays.sort Arrays s Arrays.sort(t) Arrays.sort Arrays t int count = 0; count 0 for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	} int i = 0, key = 0; int i = 0 i 0 key = 0; key 0 i < n && key < q i < n i n key < q key q {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	} {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	} if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		} s[i] < t[key] s[i] s i t[key] t key {
    			i++;
    		} i++ i if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		} s[i] == t[key] s[i] s i t[key] t key {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} count++ count i++ i key++ key {
    			key++;
    		} key++ key System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc String[] args args public class Main {

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

		int n = sc.nextInt();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

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

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

		int n = sc.nextInt();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

    	sc.close();
	}
} 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();
		int[] s = new int[n];
    	for (int i = 0; i < n; i++) {
    		s[i] = sc.nextInt();
    	}

		int q = sc.nextInt();
		int[] t = new int[q];
    	for (int i = 0; i < q; i++) {
    		t[i] = sc.nextInt();
    	}

    	Arrays.sort(s);
    	Arrays.sort(t);
    	
    	int count = 0;
    	for (int i = 0, key = 0; i < n && key < q;) {
    		if (s[i] < t[key]) {
    			i++;
    		} else if (s[i] == t[key]) {
    			count++;
    			i++;
    			key++;
//    			System.out.println(s[i]);
    		} else {
    			key++;
    		}
    	}
		
    	System.out.println(count);

    	sc.close();
	}
}