import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int n,q;
	int C=0;
	int[] S,T;
	int left,mid,right;
	
	public void input() {
		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();
	}
	
	public void search() {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.search();
	}
}
 import java.util.*; util.* java public class Main {
	Scanner sc = new Scanner(System.in);
	int n,q;
	int C=0;
	int[] S,T;
	int left,mid,right;
	
	public void input() {
		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();
	}
	
	public void search() {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.search();
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n q; q int C=0; C 0 int[] S S T; T int left left mid mid right; right public void input() {
		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();
	} input {
		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();
	} 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] 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] T i sc.nextInt() sc.nextInt sc public void search() {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	} search {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	} for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		} {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		} left = 0 left 0 right = S.length right S.length S S.length while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			} left < right left right {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				} T[i] == S[mid] T[i] T i S[mid] S mid {
					C++;
					break;
				} C++ C break; if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				} T[i] > S[mid] T[i] T i S[mid] S mid {
					left = mid +1;
				} left = mid +1 left mid +1 mid 1 {
					right = mid;
				} right = mid right mid System.out.println(C) System.out.println System.out System System.out C public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.search();
	} main {
		Main obj = new Main();
		obj.input();
		obj.search();
	} Main obj = new Main(); obj new Main() obj.input() obj.input obj obj.search() obj.search obj String[] args args public class Main {
	Scanner sc = new Scanner(System.in);
	int n,q;
	int C=0;
	int[] S,T;
	int left,mid,right;
	
	public void input() {
		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();
	}
	
	public void search() {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.search();
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	int n,q;
	int C=0;
	int[] S,T;
	int left,mid,right;
	
	public void input() {
		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();
	}
	
	public void search() {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.search();
	}
} Main
import java.util.*;
public class Main {
	Scanner sc = new Scanner(System.in);
	int n,q;
	int C=0;
	int[] S,T;
	int left,mid,right;
	
	public void input() {
		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();
	}
	
	public void search() {
		for(int i=0; i<q; i++) {
			left = 0;
			right = S.length;
			while(left < right) {
				mid = (left + right) / 2;
				if(T[i] == S[mid]) {
					C++;
					break;
				}else if(T[i] > S[mid]) {
					left = mid +1;
				}else {
					right = mid;
				}
			}
		}
		System.out.println(C);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
		obj.search();
	}
}

