

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	}
	static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	}
	static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	}

} Main public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	} main {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] a = new int[n]; a new int[n] n for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = in.nextInt();
		} {
			a[i] = in.nextInt();
		} a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in int m = in.nextInt(); m in.nextInt() in.nextInt in int[] b = new int[m]; b new int[m] m for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			b[i] = in.nextInt();
		} {
			b[i] = in.nextInt();
		} b[i] = in.nextInt() b[i] b i in.nextInt() in.nextInt in int count = 0; count 0 for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		} int bb b {
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		} {
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		} if(binarySearch(a, bb, 0, a.length) != -1)count++; binarySearch(a, bb, 0, a.length) != -1 binarySearch(a, bb, 0, a.length) binarySearch a bb 0 a.length a a.length -1 1 count++ count System.out.println(count) System.out.println System.out System System.out count in.close() in.close in String[] args args static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	} binarySearch {
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	} while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		} l != r l r {
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		} int mid = (l+r)/2; mid (l+r)/2 (l+r) l r 2 if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			} a[mid] == n a[mid] a mid n {
				return mid;
			} return mid; mid if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			} a[mid] < n a[mid] a mid n {
				l = mid + 1;
			} l = mid + 1 l mid + 1 mid 1 if(a[mid] > n){
				r = mid;
			} a[mid] > n a[mid] a mid n {
				r = mid;
			} r = mid r mid return -1; -1 1 int[]a a int n n int l l int r r public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	}
	static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	}

} public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	}
	static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	}

} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	}
	static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	}

}