
import java.util.Scanner;

public class Main {


	static int S[];
	static int n;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	}

	static boolean search(int t) {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	}

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


	static int S[];
	static int n;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	}

	static boolean search(int t) {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	}

} Main static int S[]; S static int n; n public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) n = scan.nextInt() n scan.nextInt() scan.nextInt scan 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] S i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int c = 0; c 0 for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if(search(scan.nextInt()))c++;

		} {
			if(search(scan.nextInt()))c++;

		} if(search(scan.nextInt()))c++; search(scan.nextInt()) search scan.nextInt() scan.nextInt scan c++ c System.out.println(c) System.out.println System.out System System.out c scan.close() scan.close scan String[] args args static boolean search(int t) {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	} search {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	} int l = 0 l 0 r = n r n mid; mid if(S[0] > t || S[n-1] < t)return false; S[0] > t || S[n-1] < t S[0] > t S[0] S 0 t S[n-1] < t S[n-1] S n-1 n 1 t return false; false while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		} l<r l r {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		} mid = (l+r)/2 mid (l+r)/2 (l+r) l r 2 if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true; S[mid] > t S[mid] S mid t {
				r = (l+r)/2;
			} r = (l+r)/2 r (l+r)/2 (l+r) l r 2 if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true; S[mid] < t S[mid] S mid t {
				l = (l+r)/2+1;
			} l = (l+r)/2+1 l (l+r)/2+1 (l+r)/2 (l+r) l r 2 1 if(S[mid] == t)return true; S[mid] == t S[mid] S mid t return true; true return false; false int t t public class Main {


	static int S[];
	static int n;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	}

	static boolean search(int t) {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	}

} public class Main {


	static int S[];
	static int n;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	}

	static boolean search(int t) {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	}

} Main

import java.util.Scanner;

public class Main {


	static int S[];
	static int n;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		n = scan.nextInt();
		S = new int[n];
		for(int i = 0;i < n;i++)S[i] = scan.nextInt();
		int q = scan.nextInt();
		int c = 0;
		for(int i = 0;i < q;i++) {
			if(search(scan.nextInt()))c++;

		}

		System.out.println(c);
		scan.close();

	}

	static boolean search(int t) {
		int l = 0, r = n, mid;
		if(S[0] > t || S[n-1] < t)return false;

		while(l<r) {
			mid = (l+r)/2;
			if(S[mid] > t) {
				r = (l+r)/2;
			}else if(S[mid] < t){
				l = (l+r)/2+1;
			}else if(S[mid] == t)return true;

		}

		return false;

	}

}
