import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	}

	static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	}

	static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	}
} Main public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	} main {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	} BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) ); br new BufferedReader( new InputStreamReader(System.in) ) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] temp; temp temp = br.readLine().split(" ") temp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] S = new int[n]; S new int[n] n for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		} int i=0; int i=0; i 0 i < n i n i++ i++ i {
			S[i] = Integer.parseInt(temp[i]);
		} {
			S[i] = Integer.parseInt(temp[i]);
		} S[i] = Integer.parseInt(temp[i]) S[i] S i Integer.parseInt(temp[i]) Integer.parseInt Integer temp[i] temp i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br temp = br.readLine().split(" ") temp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] T = new int[q]; T new int[q] q for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		} int i=0; int i=0; i 0 i < q i q i++ i++ i {
			T[i] = Integer.parseInt(temp[i]);
		} {
			T[i] = Integer.parseInt(temp[i]);
		} T[i] = Integer.parseInt(temp[i]) T[i] T i Integer.parseInt(temp[i]) Integer.parseInt Integer temp[i] temp i int count = 0; count 0 for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		} int i=0; int i=0; i 0 i < q i q i++ i++ i {
			count += binarySearch(T[i], S);
		} {
			count += binarySearch(T[i], S);
		} count += binarySearch(T[i], S) count binarySearch(T[i], S) binarySearch T[i] T i S System.out.println(count) System.out.println System.out System System.out count String[] args args static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	} binarySearch {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	} int l = 0; l 0 int r = S.length; r S.length S S.length while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		} l < r l r {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		} int m = (l + r) / 2; m (l + r) / 2 (l + r) l r 2 if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1; Ti == S[m] Ti S[m] S m return 1; 1 if (Ti < S[m]) r = m;
			else l = m+1; Ti < S[m] Ti S[m] S m r = m r m l = m+1 l m+1 m 1 return 0; 0 int Ti Ti int[] S S public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	}

	static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	}

	static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO ?????????????????????????????????????????????
		BufferedReader br =
				new BufferedReader( new InputStreamReader(System.in) );

		int n = Integer.parseInt(br.readLine());

		String[] temp;
		temp = br.readLine().split(" ");

		int[] S = new int[n];
		for (int i=0; i < n; i++) {
			S[i] = Integer.parseInt(temp[i]);
		}

		int q = Integer.parseInt(br.readLine());

		temp = br.readLine().split(" ");

		int[] T = new int[q];
		for (int i=0; i < q; i++) {
			T[i] = Integer.parseInt(temp[i]);
		}

		int count = 0;
		for (int i=0; i < q; i++) {
			count += binarySearch(T[i], S);
		}

		System.out.println(count);
	}

	static int binarySearch(int Ti, int[] S) {
		int l = 0;
		int r = S.length;
		while (l < r) {
			int m = (l + r) / 2;
			if (Ti == S[m]) return 1;
			else if (Ti < S[m]) r = m;
			else l = m+1;
		}
		return 0;
	}
}