import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	}

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	}

} Main public static void main(String[] args){
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	} main {
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	} int n n q q i i j j ans=0 ans 0 left left right right mid mid key; key Scanner sc=new Scanner(System.in); sc new Scanner(System.in) n=sc.nextInt() n sc.nextInt() sc.nextInt sc int s[]=new int[n]; s new int[n] n for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		} i=0; 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 q=sc.nextInt() q sc.nextInt() sc.nextInt sc int t[]=new int[q]; t new int[q] q for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		} j=0; j=0 j 0 j<q j q j++ j++ j {
			t[j]=sc.nextInt();
		} {
			t[j]=sc.nextInt();
		} t[j]=sc.nextInt() t[j] t j sc.nextInt() sc.nextInt sc for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		} j=0; j=0 j 0 j<q j q j++ j++ j {
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		} {
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		} key=t[j] key t[j] t j left=0 left 0 right=n right n while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			} left<right left right {
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			} mid=(left+right)/2 mid (left+right)/2 (left+right) left right 2 if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    } s[mid]==key s[mid] s mid key {
			    	left=right+1;
			        ans++;
			    } left=right+1 left right+1 right 1 ans++ ans if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    } key<s[mid] key s[mid] s mid {
			    	right=mid;
			    } right=mid right mid {
			    	left=mid+1;
			    } left=mid+1 left mid+1 mid 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	}

} public class Main {
	public static void main(String[] args){
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	}

} Main
import java.util.Scanner;


public class Main {
	public static void main(String[] args){
		// TODO ?????????????????????????????????????????????
		int n,q,i,j,ans=0,left,right,mid,key;
		Scanner sc=new Scanner(System.in);
		n=sc.nextInt();
		int s[]=new int[n];
		for(i=0;i<n;i++){
			s[i]=sc.nextInt();
		}
		q=sc.nextInt();
		int t[]=new int[q];
		for(j=0;j<q;j++){
			t[j]=sc.nextInt();
		}

		for(j=0;j<q;j++){
			key=t[j];
			left=0;
		    right=n;
		    while(left<right){
		    	mid=(left+right)/2;

			    if(s[mid]==key){
			    	left=right+1;
			        ans++;
			    }else if(key<s[mid]){
			    	right=mid;
			    }else{
			    	left=mid+1;
			    }
			}


		}
		System.out.println(ans);



	}

}