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 + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		System.out.println(count);
	}

	private static int binarySearch(int[] ary, int target) {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	}
} 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 + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		System.out.println(count);
	}

	private static int binarySearch(int[] ary, int target) {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] s = new int[n + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		System.out.println(count);
	} main {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] s = new int[n + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		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 + 1]; s new int[n + 1] n + 1 n 1 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 sc.close() sc.close sc int count = 0; count 0 for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		} int sagasu t {
			if(binarySearch(s, sagasu) != -1) count++;
		} {
			if(binarySearch(s, sagasu) != -1) count++;
		} if(binarySearch(s, sagasu) != -1) count++; binarySearch(s, sagasu) != -1 binarySearch(s, sagasu) binarySearch s sagasu -1 1 count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args private static int binarySearch(int[] ary, int target) {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	} binarySearch {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	} int low = 0; low 0 int high = ary.length-1; high ary.length-1 ary.length ary ary.length 1 int mid = (low + high) / 2; mid (low + high) / 2 (low + high) low high 2 while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		} low < high low high {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		} if(ary[mid] == target) return mid; ary[mid] == target ary[mid] ary mid target return mid; mid if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			} ary[mid] < target ary[mid] ary mid target {
				low = mid + 1;
			} low = mid + 1 low mid + 1 mid 1 {
				high = mid;
			} high = mid high mid mid = (low + high) / 2 mid (low + high) / 2 (low + high) low high 2 return -1; -1 1 int[] ary ary int target target public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] s = new int[n + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		System.out.println(count);
	}

	private static int binarySearch(int[] ary, int target) {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] s = new int[n + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		System.out.println(count);
	}

	private static int binarySearch(int[] ary, int target) {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	}
} 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 + 1];		// ????????¨???????°?????????¨?????¨???????????????
		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();
		}
		sc.close();

		int count = 0;
		for(int sagasu : t) {
			if(binarySearch(s, sagasu) != -1) count++;
		}

		System.out.println(count);
	}

	private static int binarySearch(int[] ary, int target) {
		int low = 0;
		int high = ary.length-1;
		int mid = (low + high) / 2;

		while(low < high) {

			if(ary[mid] == target) return mid;

			if(ary[mid] < target) {
				low = mid + 1;
			} else {
				high = mid;
			}
			mid = (low + high) / 2;

		}
		return -1;
	}
}