import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	}
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int s[] = new int[n]; s new int[n] n String str[] = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			s[i] = Integer.parseInt(str[i]);
		} {
			s[i] = Integer.parseInt(str[i]);
		} s[i] = Integer.parseInt(str[i]) s[i] s i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i Arrays.sort(s) Arrays.sort Arrays s int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br str = br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int ans = 0; ans 0 for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		} {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		} int t = Integer.parseInt(str[i]); t Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int left = 0; left 0 int right = n; right n int mid = 0; mid 0 while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			} right - left > 1 right - left right left 1 {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			} mid = (right + left) / 2 mid (right + left) / 2 (right + left) right left 2 if (t == s[mid]) {
					ans++;
					break;
				} t == s[mid] t s[mid] s mid {
					ans++;
					break;
				} ans++ ans break; if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				} t > s[mid] t s[mid] s mid {
					left = mid;
				} left = mid left mid {
					right = mid;
				} right = mid right mid System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		int s[] = new int[n];

		String str[] = br.readLine().split(" ");
		for (int i = 0; i < n; i++) {
			s[i] = Integer.parseInt(str[i]);
		}

		Arrays.sort(s);

		int q = Integer.parseInt(br.readLine());

		str = br.readLine().split(" ");

		int ans = 0;
		for (int i = 0; i < q; i++) {
			int t = Integer.parseInt(str[i]);

			int left = 0;
			int right = n;
			int mid = 0;

			while (right - left > 1) {
				mid = (right + left) / 2;

				if (t == s[mid]) {
					ans++;
					break;
				}
				if (t > s[mid]) {
					left = mid;
				} else {
					right = mid;
				}
			}
		}

		System.out.println(ans);
	}
}

