import java.util.Scanner;

public class Main {

	static int count = 0;

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		System.out.println(count);
	}
	
	public static void binarySearch(long[] S, long T) {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	}

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

	static int count = 0;

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		System.out.println(count);
	}
	
	public static void binarySearch(long[] S, long T) {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	}

} Main static int count = 0; count 0 public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		System.out.println(count);
	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		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 long[] S = new long[n]; S new long[n] n for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = sc.nextLong();
		} {
			S[i] = sc.nextLong();
		} S[i] = sc.nextLong() S[i] S i sc.nextLong() sc.nextLong sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		} int j = 0; int j = 0; j 0 j < q j q j++ j++ j {

			long T = sc.nextLong();
			binarySearch(S, T);
		} {

			long T = sc.nextLong();
			binarySearch(S, T);
		} long T = sc.nextLong(); T sc.nextLong() sc.nextLong sc binarySearch(S, T) binarySearch S T System.out.println(count) System.out.println System.out System System.out count String[] args args public static void binarySearch(long[] S, long T) {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	} binarySearch {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	} int left = 0; left 0 int right = S.length; right S.length S S.length while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		} left < right left right {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			} S[mid] == T S[mid] S mid T {
				count++;
				return;
			} count++ count return; if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			} S[mid] > T S[mid] S mid T {
				right = mid;
			} right = mid right mid if(S[mid] < T) {
				left = mid + 1;
			} S[mid] < T S[mid] S mid T {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 long[] S S long T T public class Main {

	static int count = 0;

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		System.out.println(count);
	}
	
	public static void binarySearch(long[] S, long T) {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	}

} public class Main {

	static int count = 0;

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		System.out.println(count);
	}
	
	public static void binarySearch(long[] S, long T) {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	}

} Main
import java.util.Scanner;

public class Main {

	static int count = 0;

	public static void main(String[] args) throws Exception {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] S = new long[n];

		for(int i = 0; i < n; i++) {
			S[i] = sc.nextLong();
		}

		int q = sc.nextInt();

		for(int j = 0; j < q; j++) {

			long T = sc.nextLong();
			binarySearch(S, T);
		}
		System.out.println(count);
	}
	
	public static void binarySearch(long[] S, long T) {
		int left = 0;
		int right = S.length;
		
		while(left < right) {
			int mid = (left + right) / 2;
			if(S[mid] == T) {
				count++;
				return;
			} else if(S[mid] > T) {
				right = mid;
			} else if(S[mid] < T) {
				left = mid + 1;
			}
		}
	}

}
