import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	}

} Main public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	} main {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i i j j n n q q mid mid left left right; right int cnt=0; cnt 0 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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		} i=0; 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(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    } i=0; i=0 i 0 i<q i q i++ i++ i {
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    } {
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    } left =0 left 0 right = S.length right S.length S S.length while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	} left < right left right {
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	} mid = (left + right)/2 mid (left + right)/2 (left + right) left right 2 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 } T[i]==S[mid] T[i] T i S[mid] S mid {
	    			 cnt++;
	    			 break;
	    		 } cnt++ cnt break; if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid; T[i]>S[mid] T[i] T i S[mid] S mid left = mid +1 left mid +1 mid 1 if(T[i] < S[mid])  right = mid; T[i] < S[mid] T[i] T i S[mid] S mid right = mid right mid System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	}

} public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int i, j,n,q,mid,left,right;
		int cnt=0;
		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(i=0;i<q;i++){
			T[i] = sc.nextInt();
		}
		
	    for(i=0;i<q;i++){
	    	left =0;
	    	right = S.length;
	    	while(left < right){
	    		 mid = (left + right)/2;
	    		 if(T[i]==S[mid]){
	    			 cnt++;
	    			 break;
	    		 }
	    		 if(T[i]>S[mid]) left = mid +1;
	    		 else if(T[i] < S[mid])  right = mid;
	    	}
	    }
		
	    System.out.println(cnt);
	}

}
