import java.util.Scanner;

public class Main {
	int n;
	int s[];
	int q;
	int t[];
	public static void main(String args[]) {
		new Main().run();
	}
	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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		scan.close();
	}
	public void run() {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	int n;
	int s[];
	int q;
	int t[];
	public static void main(String args[]) {
		new Main().run();
	}
	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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		scan.close();
	}
	public void run() {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	}
} Main int n; n int s[]; s int q; q int t[]; t public static void main(String args[]) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String args[] args 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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		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] = scan.nextInt() s[i] s i scan.nextInt() scan.nextInt scan q = scan.nextInt() q scan.nextInt() scan.nextInt scan t = new int[n] t new int[n] n for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			t[i] = scan.nextInt();
		} {
			t[i] = scan.nextInt();
		} t[i] = scan.nextInt() t[i] t i scan.nextInt() scan.nextInt scan scan.close() scan.close scan public void run() {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	} run {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	} int cnt = 0; cnt 0 for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		} int j = 0; int j = 0; j 0 j < q j q j++ j++ j {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		} {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		} int left = 0; left 0 int right = n; right n while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			} left < right left right {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (s[mid] == t[j]) {
					cnt++;
					break;
				} s[mid] == t[j] s[mid] s mid t[j] t j {
					cnt++;
					break;
				} cnt++ cnt break; if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				} s[mid] <= t[j] s[mid] s mid t[j] t j {
					left = mid + 1;
				} left = mid + 1 left mid + 1 mid 1 {
					right = mid;
				} right = mid right mid System.out.println(cnt) System.out.println System.out System System.out cnt public class Main {
	int n;
	int s[];
	int q;
	int t[];
	public static void main(String args[]) {
		new Main().run();
	}
	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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		scan.close();
	}
	public void run() {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	}
} public class Main {
	int n;
	int s[];
	int q;
	int t[];
	public static void main(String args[]) {
		new Main().run();
	}
	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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		scan.close();
	}
	public void run() {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	}
} Main
import java.util.Scanner;

public class Main {
	int n;
	int s[];
	int q;
	int t[];
	public static void main(String args[]) {
		new Main().run();
	}
	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();
		}
		q = scan.nextInt();
		t = new int[n];
		for (int i = 0; i < q; i++) {
			t[i] = scan.nextInt();
		}
		scan.close();
	}
	public void run() {
		int cnt = 0;
		for (int j = 0; j < q; j++) {
			int left = 0;
			int right = n;
			while (left < right) {
				int mid = (left + right) / 2;
				if (s[mid] == t[j]) {
					cnt++;
					break;
				}
				if (s[mid] <= t[j]) {
					left = mid + 1;
				} else {
					right = mid;
				}
			}
		}
		System.out.println(cnt);
	}
}

