import java.util.Scanner;

public class Main {

	static int n;
	static int[] S;
	static int q;
	static int[] T;
	static int ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	}

	private static void binarySearch(int num) {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	static int n;
	static int[] S;
	static int q;
	static int[] T;
	static int ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	}

	private static void binarySearch(int num) {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	}
} Main static int n; n static int[] S; S static int q; q static int[] T; T static int ans; ans public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc 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 q = sc.nextInt() q sc.nextInt() sc.nextInt sc 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 sc.close() sc.close sc ans = 0 ans 0 for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			binarySearch(T[i]);
		} {
			binarySearch(T[i]);
		} binarySearch(T[i]) binarySearch T[i] T i System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static void binarySearch(int num) {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	} binarySearch {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	} int left = 0; left 0 int right = n; right n while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		} left < right left right {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			} S[mid] == num S[mid] S mid num {
				ans++;
				return;
			} ans++ ans return; if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			} S[mid] > num S[mid] S mid num {
				right = mid;
			} right = mid right mid if (S[mid] < num) {
				left = mid + 1;
			} S[mid] < num S[mid] S mid num {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 int num num public class Main {

	static int n;
	static int[] S;
	static int q;
	static int[] T;
	static int ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	}

	private static void binarySearch(int num) {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	}
} public class Main {

	static int n;
	static int[] S;
	static int q;
	static int[] T;
	static int ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	}

	private static void binarySearch(int num) {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	}
} Main
import java.util.Scanner;

public class Main {

	static int n;
	static int[] S;
	static int q;
	static int[] T;
	static int ans;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		q = sc.nextInt();
		T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		sc.close();

		ans = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(T[i]);
		}
		System.out.println(ans);
	}

	private static void binarySearch(int num) {
		int left = 0;
		int right = n;

		while (left < right) {
			int mid = (left + right) / 2;
			if (S[mid] == num) {
				ans++;
				return;
			} else if (S[mid] > num) {
				right = mid;
			} else if (S[mid] < num) {
				left = mid + 1;
			}
		}
	}
}