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

public class Main{
	void run() {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main{
	void run() {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	} run {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int count = 0; count 0 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 Arrays.sort(S) Arrays.sort Arrays S int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		} int j = 0; int j = 0; j 0 j < q j q j++ j++ j {
			T[j] = sc.nextInt();
		} {
			T[j] = sc.nextInt();
		} T[j] = sc.nextInt() T[j] T j sc.nextInt() sc.nextInt sc for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		} {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		} int left = 0; left 0 int right = n; right n while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			} left < right left right {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			} int mid = (left + right)/2; mid (left + right)/2 (left + right) left right 2 if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1; T[i] == S[mid] T[i] T i S[mid] S mid {
					count++;
					break;
				} count++ count break; if(T[i] < S[mid]) right = mid;
				else left = mid + 1; T[i] < S[mid] T[i] T i S[mid] S mid right = mid right mid left = mid + 1 left mid + 1 mid 1 System.out.println(count) System.out.println System.out System System.out count sc.close() sc.close sc void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	} debug {
		System.out.println(Arrays.deepToString(o));
	} System.out.println(Arrays.deepToString(o)) System.out.println System.out System System.out Arrays.deepToString(o) Arrays.deepToString Arrays o Object... o o public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main{
	void run() {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
} public class Main{
	void run() {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	void run() {
		Scanner sc = new Scanner(System.in);
		int count = 0;
		int n = sc.nextInt();
		int[] S = new int[n];
		
		for(int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		Arrays.sort(S);
		int q = sc.nextInt();
		int[] T = new int[q];
		for(int j = 0; j < q; j++) {
			T[j] = sc.nextInt();
		}
		for(int i = 0; i < q; i++) {
			int left = 0;
			int right = n;
			while(left < right) {
				int mid = (left + right)/2;
				if(T[i] == S[mid]) {
					count++;
					break;
				}
				else if(T[i] < S[mid]) right = mid;
				else left = mid + 1;
			}
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}
