import java.util.*;

class Main {

	static Scanner in = new Scanner(System.in);

    void solve() {
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i = 0; i < n; i++) s[i] = in.nextInt();
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i = 0; i < q; i++) t[i] = in.nextInt();
		int ans = 0;
		for(int i : t) if(serch(s, i) > 0) ans++;
		System.out.println(ans);
	}

	int serch(int[] a, int n){
		int left = 0;
		int right = a.length;
		int mid = -1;
		while(left < right){
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		}
		return 0;
	}

    public static void main(String[] args) {
        new Main().solve();
    }
} import java.util.*; util.* java class Main {

	static Scanner in = new Scanner(System.in);

    void solve() {
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i = 0; i < n; i++) s[i] = in.nextInt();
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i = 0; i < q; i++) t[i] = in.nextInt();
		int ans = 0;
		for(int i : t) if(serch(s, i) > 0) ans++;
		System.out.println(ans);
	}

	int serch(int[] a, int n){
		int left = 0;
		int right = a.length;
		int mid = -1;
		while(left < right){
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		}
		return 0;
	}

    public static void main(String[] args) {
        new Main().solve();
    }
} Main static Scanner in = new Scanner(System.in); in new Scanner(System.in) void solve() {
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i = 0; i < n; i++) s[i] = in.nextInt();
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i = 0; i < q; i++) t[i] = in.nextInt();
		int ans = 0;
		for(int i : t) if(serch(s, i) > 0) ans++;
		System.out.println(ans);
	} solve {
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i = 0; i < n; i++) s[i] = in.nextInt();
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i = 0; i < q; i++) t[i] = in.nextInt();
		int ans = 0;
		for(int i : t) if(serch(s, i) > 0) ans++;
		System.out.println(ans);
	} int n = in.nextInt(); n in.nextInt() in.nextInt in int[] s = new int[n]; s new int[n] n for(int i = 0; i < n; i++) s[i] = in.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i s[i] = in.nextInt(); s[i] = in.nextInt() s[i] s i in.nextInt() in.nextInt in int q = in.nextInt(); q in.nextInt() in.nextInt in int[] t = new int[q]; t new int[q] q for(int i = 0; i < q; i++) t[i] = in.nextInt(); int i = 0; int i = 0; i 0 i < q i q i++ i++ i t[i] = in.nextInt(); t[i] = in.nextInt() t[i] t i in.nextInt() in.nextInt in int ans = 0; ans 0 for(int i : t) if(serch(s, i) > 0) ans++; int i t if(serch(s, i) > 0) ans++; if(serch(s, i) > 0) ans++; serch(s, i) > 0 serch(s, i) serch s i 0 ans++ ans System.out.println(ans) System.out.println System.out System System.out ans int serch(int[] a, int n){
		int left = 0;
		int right = a.length;
		int mid = -1;
		while(left < right){
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		}
		return 0;
	} serch {
		int left = 0;
		int right = a.length;
		int mid = -1;
		while(left < right){
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		}
		return 0;
	} int left = 0; left 0 int right = a.length; right a.length a a.length int mid = -1; mid -1 1 while(left < right){
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		} left < right left right {
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid; a[mid] == n a[mid] a mid n return 1; 1 if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid; n > a[mid] n a[mid] a mid left = mid + 1 left mid + 1 mid 1 if(n < a[mid]) right = mid; n < a[mid] n a[mid] a mid right = mid right mid return 0; 0 int[] a a int n n public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args
import java.util.*;

class Main {

	static Scanner in = new Scanner(System.in);

    void solve() {
		int n = in.nextInt();
		int[] s = new int[n];
		for(int i = 0; i < n; i++) s[i] = in.nextInt();
		int q = in.nextInt();
		int[] t = new int[q];
		for(int i = 0; i < q; i++) t[i] = in.nextInt();
		int ans = 0;
		for(int i : t) if(serch(s, i) > 0) ans++;
		System.out.println(ans);
	}

	int serch(int[] a, int n){
		int left = 0;
		int right = a.length;
		int mid = -1;
		while(left < right){
			mid = (left + right) / 2;
			if(a[mid] == n) return 1;
			else if(n > a[mid]) left = mid + 1;
			else if(n < a[mid]) right = mid;
		}
		return 0;
	}

    public static void main(String[] args) {
        new Main().solve();
    }
}