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

class Main {

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

		//一行目をインプット
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i=0; i<n; i++) {
			S[i] = scan.nextInt();
		}

		//二行目をインプット
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = scan.nextInt();
		}

		Arrays.sort(S);
		Arrays.sort(T);
		int count =0;

		if(n < q){

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		}

		if(q < n){
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		}

		System.out.println(count);
	}
}
 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util class Main {

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

		//一行目をインプット
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i=0; i<n; i++) {
			S[i] = scan.nextInt();
		}

		//二行目をインプット
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = scan.nextInt();
		}

		Arrays.sort(S);
		Arrays.sort(T);
		int count =0;

		if(n < q){

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		}

		if(q < n){
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		}

		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		//一行目をインプット
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i=0; i<n; i++) {
			S[i] = scan.nextInt();
		}

		//二行目をインプット
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = scan.nextInt();
		}

		Arrays.sort(S);
		Arrays.sort(T);
		int count =0;

		if(n < q){

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		}

		if(q < n){
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		}

		System.out.println(count);
	} main {
		Scanner scan = new Scanner(System.in);

		//一行目をインプット
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i=0; i<n; i++) {
			S[i] = scan.nextInt();
		}

		//二行目をインプット
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = scan.nextInt();
		}

		Arrays.sort(S);
		Arrays.sort(T);
		int count =0;

		if(n < q){

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		}

		if(q < n){
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		}

		System.out.println(count);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] S = new int[n]; S new int[n] n for (int i=0; i<n; i++) {
			S[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			S[i] = scan.nextInt();
		} {
			S[i] = scan.nextInt();
		} S[i] = scan.nextInt() S[i] S i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int[] T = new int[q]; T new int[q] q for (int i=0; i<q; i++) {
			T[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			T[i] = scan.nextInt();
		} {
			T[i] = scan.nextInt();
		} T[i] = scan.nextInt() T[i] T i scan.nextInt() scan.nextInt scan Arrays.sort(S) Arrays.sort Arrays S Arrays.sort(T) Arrays.sort Arrays T int count =0; count 0 if(n < q){

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		} n < q n q {

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		} for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			} {
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			} for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				} int j = 0; int j = 0; j 0 j < q j q j++ j++ j {
					if(S[i] == T[j]){
						count++;
						break;
					}
				} {
					if(S[i] == T[j]){
						count++;
						break;
					}
				} if(S[i] == T[j]){
						count++;
						break;
					} S[i] == T[j] S[i] S i T[j] T j {
						count++;
						break;
					} count++ count break; if(q < n){
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		} q < n q n {
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		} for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			} {
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			} for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
					if(S[j] == T[i]){
						count++;
						break;
					}
				} {
					if(S[j] == T[i]){
						count++;
						break;
					}
				} if(S[j] == T[i]){
						count++;
						break;
					} S[j] == T[i] S[j] S j T[i] T i {
						count++;
						break;
					} count++ count break; System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Arrays;
import java.util.Scanner;

class Main {

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

		//一行目をインプット
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i=0; i<n; i++) {
			S[i] = scan.nextInt();
		}

		//二行目をインプット
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i=0; i<q; i++) {
			T[i] = scan.nextInt();
		}

		Arrays.sort(S);
		Arrays.sort(T);
		int count =0;

		if(n < q){

			for(int i = 0; i < n;i++){
				for(int j = 0;j < q;j++){
					if(S[i] == T[j]){
						count++;
						break;
					}
				}
			}
		}

		if(q < n){
			for(int i = 0; i < q;i++){
				for(int j = 0;j < n;j++){
					if(S[j] == T[i]){
						count++;
						break;
					}
				}
			}
		}

		System.out.println(count);
	}
}

