import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] 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 int count = 0; count 0 for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		} {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		} int t = T[i]; t T[i] T i int l = -1; l -1 1 int u = S.length; u S.length S S.length while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			} u - l > 1 u - l u l 1 {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			} int m = (u + l) / 2; m (u + l) / 2 (u + l) u l 2 if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				} t == S[m] t S[m] S m { 
					count++;
					break;
				} count++ count break; if (t < S[m]) {
					u = m;
				} else {
					l = m;
				} t < S[m] t S[m] S m {
					u = m;
				} u = m u m {
					l = m;
				} l = m l m System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] S = new int[n]; 
		for (int i = 0; i < n; i++) {
			S[i] = sc.nextInt();
		}
		
		int q = sc.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
		}
		
		int count = 0;
		for (int i = 0; i < T.length; i++) {
			int t = T[i];
			
			int l = -1;
			int u = S.length;
			while(u - l > 1) {
				int m = (u + l) / 2;	
				if(t == S[m]) { 
					count++;
					break;
				} else if (t < S[m]) {
					u = m;
				} else {
					l = m;
				}
			}
		}
		System.out.println(count);
	}
}