import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}

} Main public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc long[] S = new long[n]; S new long[n] n for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = sc.nextLong();
		} {
			S[i] = sc.nextLong();
		} S[i] = sc.nextLong() S[i] S i sc.nextLong() sc.nextLong sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int count = 0; count 0 for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		} int j = 0; int j = 0; j 0 j < q j q j++ j++ j {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		} {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		} long T = sc.nextLong(); T sc.nextLong() sc.nextLong sc for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				if(T == S[i]) {
					count++;
					break;
				}
			} {
				if(T == S[i]) {
					count++;
					break;
				}
			} if(T == S[i]) {
					count++;
					break;
				} T == S[i] T S[i] S i {
					count++;
					break;
				} count++ count break; System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}

} public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();
		int count = 0;

		for(int j = 0; j < q; j++) {
			long T = sc.nextLong();
			for(int i = 0; i < n; i++) {
				if(T == S[i]) {
					count++;
					break;
				}
			}
		}
		System.out.println(count);
	}

}
