import java.util.Scanner;

class Main{
    private static int nS;
    private static int nT;
    private static int[] S;
    private static int[] T;

    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	nS = sc.nextInt();	
	S = new int[nS];
	for(int i=0;i<nS;i++){
	    S[i] = sc.nextInt();
	}
       
	nT = sc.nextInt();
	T = new int[nT];
	for(int i=0;i<nT;i++){
	    T[i] = sc.nextInt();
	}
	/*
	for(int i=0;i<nS;i++){
	    if(binary(0,nS,T[i])){
		cnt++;
	    }
	}
	*/
	
	int cnt = 0;
	for(int i=0;i<nT;i++){
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	}
	System.out.println(cnt);
  
    }

    public static boolean binary(int s,int t, int x){
	if(s==t){
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	}else{
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	}
    }
}
 import java.util.Scanner; Scanner java.util class Main{
    private static int nS;
    private static int nT;
    private static int[] S;
    private static int[] T;

    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	nS = sc.nextInt();	
	S = new int[nS];
	for(int i=0;i<nS;i++){
	    S[i] = sc.nextInt();
	}
       
	nT = sc.nextInt();
	T = new int[nT];
	for(int i=0;i<nT;i++){
	    T[i] = sc.nextInt();
	}
	/*
	for(int i=0;i<nS;i++){
	    if(binary(0,nS,T[i])){
		cnt++;
	    }
	}
	*/
	
	int cnt = 0;
	for(int i=0;i<nT;i++){
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	}
	System.out.println(cnt);
  
    }

    public static boolean binary(int s,int t, int x){
	if(s==t){
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	}else{
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	}
    }
} Main private static int nS; nS private static int nT; nT private static int[] S; S private static int[] T; T public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	nS = sc.nextInt();	
	S = new int[nS];
	for(int i=0;i<nS;i++){
	    S[i] = sc.nextInt();
	}
       
	nT = sc.nextInt();
	T = new int[nT];
	for(int i=0;i<nT;i++){
	    T[i] = sc.nextInt();
	}
	/*
	for(int i=0;i<nS;i++){
	    if(binary(0,nS,T[i])){
		cnt++;
	    }
	}
	*/
	
	int cnt = 0;
	for(int i=0;i<nT;i++){
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	}
	System.out.println(cnt);
  
    } main {

	Scanner sc = new Scanner(System.in);

	nS = sc.nextInt();	
	S = new int[nS];
	for(int i=0;i<nS;i++){
	    S[i] = sc.nextInt();
	}
       
	nT = sc.nextInt();
	T = new int[nT];
	for(int i=0;i<nT;i++){
	    T[i] = sc.nextInt();
	}
	/*
	for(int i=0;i<nS;i++){
	    if(binary(0,nS,T[i])){
		cnt++;
	    }
	}
	*/
	
	int cnt = 0;
	for(int i=0;i<nT;i++){
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	}
	System.out.println(cnt);
  
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) nS = sc.nextInt() nS sc.nextInt() sc.nextInt sc S = new int[nS] S new int[nS] nS for(int i=0;i<nS;i++){
	    S[i] = sc.nextInt();
	} int i=0; int i=0; i 0 i<nS i nS i++ i++ i {
	    S[i] = sc.nextInt();
	} {
	    S[i] = sc.nextInt();
	} S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc nT = sc.nextInt() nT sc.nextInt() sc.nextInt sc T = new int[nT] T new int[nT] nT for(int i=0;i<nT;i++){
	    T[i] = sc.nextInt();
	} int i=0; int i=0; i 0 i<nT i nT i++ i++ i {
	    T[i] = sc.nextInt();
	} {
	    T[i] = sc.nextInt();
	} T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 for(int i=0;i<nT;i++){
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	} int i=0; int i=0; i 0 i<nT i nT i++ i++ i {
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	} {
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	} int right=S.length-1; right S.length-1 S.length S S.length 1 int left = 0; left 0 int center = (right+left)/2; center (right+left)/2 (right+left) right left 2 while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    } left<=right left right {
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    } if(S[center]==T[i]){
		    cnt++;
		    break;
		} S[center]==T[i] S[center] S center T[i] T i {
		    cnt++;
		    break;
		} cnt++ cnt break; if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		} S[center]>T[i] S[center] S center T[i] T i {
		    right=center-1;
		} right=center-1 right center-1 center 1 {
		    left=center+1;
		} left=center+1 left center+1 center 1 center = (right+left)/2 center (right+left)/2 (right+left) right left 2 System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public static boolean binary(int s,int t, int x){
	if(s==t){
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	}else{
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	}
    } binary {
	if(s==t){
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	}else{
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	}
    } if(s==t){
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	}else{
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	} s==t s t {
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	} if(x==S[s]){
		return true;
	    }else{
		return false;
	    } x==S[s] x S[s] S s {
		return true;
	    } return true; true {
		return false;
	    } return false; false {
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	} if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    } x>=S[(s+t)/2] x S[(s+t)/2] S (s+t)/2 (s+t) s t 2 {
		return binary((s+t)/2,t,x);
	    } return binary((s+t)/2,t,x); binary((s+t)/2,t,x) binary (s+t)/2 (s+t) s t 2 t x {
		return binary(s,(s+t)/2,x);
	    } return binary(s,(s+t)/2,x); binary(s,(s+t)/2,x) binary s (s+t)/2 (s+t) s t 2 x int s s int t t int x x
import java.util.Scanner;

class Main{
    private static int nS;
    private static int nT;
    private static int[] S;
    private static int[] T;

    public static void main(String[] args){

	Scanner sc = new Scanner(System.in);

	nS = sc.nextInt();	
	S = new int[nS];
	for(int i=0;i<nS;i++){
	    S[i] = sc.nextInt();
	}
       
	nT = sc.nextInt();
	T = new int[nT];
	for(int i=0;i<nT;i++){
	    T[i] = sc.nextInt();
	}
	/*
	for(int i=0;i<nS;i++){
	    if(binary(0,nS,T[i])){
		cnt++;
	    }
	}
	*/
	
	int cnt = 0;
	for(int i=0;i<nT;i++){
	    int right=S.length-1;
	    int left = 0;
	    int center = (right+left)/2;
	    while(left<=right){
		if(S[center]==T[i]){
		    cnt++;
		    break;
		}
		if(S[center]>T[i]){
		    right=center-1;
		}else{
		    left=center+1;
		}
		center = (right+left)/2;
	    }
	}
	System.out.println(cnt);
  
    }

    public static boolean binary(int s,int t, int x){
	if(s==t){
	    if(x==S[s]){
		return true;
	    }else{
		return false;
	    }
	}else{
	    if(x>=S[(s+t)/2]){
		return binary((s+t)/2,t,x);
	    }else{
		return binary(s,(s+t)/2,x);
	    }
	}
    }
}

