import java.util.Scanner;
public class Main {
	public static int search(int[] a,int key,int n){
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static int search(int[] a,int key,int n){
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	}

} Main public static int search(int[] a,int key,int n){
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	} search {
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	} int left = 0; left 0 int right = n; right n int mid = 0; mid 0 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; 1 if(key<a[mid])
				right = mid;
			else
				left = mid +1; key<a[mid] key a[mid] a mid right = mid right mid left = mid +1 left mid +1 mid 1 return 0; 0 int[] a a int key key int n n public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int result=0; result 0 int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] S = new int[n+1]; S new int[n+1] n+1 n 1 for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		} int i = 0 ; int i = 0 ; i 0 i < n i n i ++ i ++ i {
			S[i]=scan.nextInt();
		} {
			S[i]=scan.nextInt();
		} S[i]=scan.nextInt() S[i] S i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int[] T = new int[q]; T new int[q] q for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		} int i = 0 ; int i = 0 ; i 0 i < q i q i ++ i ++ i {
			T[i]=scan.nextInt();
		} {
			T[i]=scan.nextInt();
		} T[i]=scan.nextInt() T[i] T i scan.nextInt() scan.nextInt scan for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		} int i = 0; int i = 0; i 0 i < q i q i ++ i ++ i {
			result += search(S,T[i],n);	
		} {
			result += search(S,T[i],n);	
		} result += search(S,T[i],n) result search(S,T[i],n) search S T[i] T i n System.out.println(result) System.out.println System.out System System.out result scan.close() scan.close scan String[] args args public class Main {
	public static int search(int[] a,int key,int n){
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	}

} public class Main {
	public static int search(int[] a,int key,int n){
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	}

} Main
import java.util.Scanner;
public class Main {
	public static int search(int[] a,int key,int n){
		int left = 0;
		int right = n;
		int mid = 0;
		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 0;
	}
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int result=0;
		int n = scan.nextInt();
		int[] S = new int[n+1];
		for(int i = 0 ; i < n ; i ++){
			S[i]=scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for(int i = 0 ; i < q ; i ++){
			T[i]=scan.nextInt();
		}
		for(int i = 0; i < q ; i ++){
			result += search(S,T[i],n);	
		}
		System.out.println(result);
		scan.close();
	}

}