import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		ALDS1_4_B();
	}

	public static void ALDS1_4_B() {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		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.*; util.* java public class Main {
	public static void main(String[] args) {
		ALDS1_4_B();
	}

	public static void ALDS1_4_B() {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		ALDS1_4_B();
	} main {
		ALDS1_4_B();
	} ALDS1_4_B() ALDS1_4_B String[] args args public static void ALDS1_4_B() {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		System.out.println(ans);
	} ALDS1_4_B {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int ans = 0; ans 0 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[n]; T new int[n] n for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		} {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		} T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			} Arrays.binarySearch(S, T[i]) >= 0 Arrays.binarySearch(S, T[i]) Arrays.binarySearch Arrays S T[i] T i 0 {
				ans++;
			} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans public class Main {
	public static void main(String[] args) {
		ALDS1_4_B();
	}

	public static void ALDS1_4_B() {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		ALDS1_4_B();
	}

	public static void ALDS1_4_B() {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		ALDS1_4_B();
	}

	public static void ALDS1_4_B() {
		Scanner sc = new Scanner(System.in);
		int ans = 0;
		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[n];
		for(int i = 0; i < q; i++) {
			T[i] = sc.nextInt();
			if(Arrays.binarySearch(S, T[i]) >= 0) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}
