import java.util.Scanner;

public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	}
	
	public static int binarySearch(int A[], int key, int n){
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	}

}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	}
	
	public static int binarySearch(int A[], int key, int n){
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	}

} Main public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	} 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 int key = 0; key 0 int ans = 0; ans 0 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 for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		} {
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		} key = T[i] key T[i] T i if(binarySearch(S, key, n) == 1){
				ans++;
			} binarySearch(S, key, n) == 1 binarySearch(S, key, n) binarySearch S key n 1 {
				ans++;
			} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String arg[] arg public static int binarySearch(int A[], int key, int n){
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	} binarySearch {
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	} int mid = 0; mid 0 int left = 0; left 0 int right = n; right n while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		} left < right left right {
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			} A[mid]==key A[mid] A mid key {
				return 1;
			} return 1; 1 if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			} key < A[mid] key A[mid] A mid {
				right = mid;
			} right = mid right mid {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 return -1; -1 1 int A[] A int key key int n n public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	}
	
	public static int binarySearch(int A[], int key, int n){
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	}

} public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	}
	
	public static int binarySearch(int A[], int key, int n){
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	}

} Main
import java.util.Scanner;

public class Main {
	public static void main(String arg[]){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n+1];
		int key = 0;
		int ans = 0;

		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();
		}
		for(int i=0; i<q; i++){
			key = T[i];
			if(binarySearch(S, key, n) == 1){
				ans++;
			}
		}
		System.out.println(ans);
	}
	
	public static int binarySearch(int A[], int key, int n){
		int mid = 0;
		int left = 0;
		int right = n;
		while (left < right){
			mid = (left + right) / 2;
			if(A[mid]==key){
				return 1;
			} else if(key < A[mid]){
				right = mid;
			} else {
				left = mid + 1;
			}
		}
		return -1;
	}

}

