import java.util.Scanner;

class Main{
    public static void main(String[] args){
	int i;
	int j;
	int key;
	int count = 0;
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int S[] = new int[n];
	for(i=0 ; i<n ; i++){S[i] = scan.nextInt();}

	int q = scan.nextInt();
	int T[] = new int[q];
	for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}

	int l;
	int r;
	int m;
	for(j=0 ; j<q ; j++){
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	}

	System.out.println(count);

    }
}
 import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
	int i;
	int j;
	int key;
	int count = 0;
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int S[] = new int[n];
	for(i=0 ; i<n ; i++){S[i] = scan.nextInt();}

	int q = scan.nextInt();
	int T[] = new int[q];
	for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}

	int l;
	int r;
	int m;
	for(j=0 ; j<q ; j++){
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	}

	System.out.println(count);

    }
} Main public static void main(String[] args){
	int i;
	int j;
	int key;
	int count = 0;
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int S[] = new int[n];
	for(i=0 ; i<n ; i++){S[i] = scan.nextInt();}

	int q = scan.nextInt();
	int T[] = new int[q];
	for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}

	int l;
	int r;
	int m;
	for(j=0 ; j<q ; j++){
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	}

	System.out.println(count);

    } main {
	int i;
	int j;
	int key;
	int count = 0;
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int S[] = new int[n];
	for(i=0 ; i<n ; i++){S[i] = scan.nextInt();}

	int q = scan.nextInt();
	int T[] = new int[q];
	for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}

	int l;
	int r;
	int m;
	for(j=0 ; j<q ; j++){
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	}

	System.out.println(count);

    } int i; i int j; j int key; key int count = 0; count 0 Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int S[] = new int[n]; S new int[n] n for(i=0 ; i<n ; i++){S[i] = scan.nextInt();} i=0 ; 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(j=0 ; j<q ; j++){T[j] = scan.nextInt();} j=0 ; j=0 j 0 j<q j q j++ j++ j {T[j] = scan.nextInt();} {T[j] = scan.nextInt();} T[j] = scan.nextInt() T[j] T j scan.nextInt() scan.nextInt scan int l; l int r; r int m; m for(j=0 ; j<q ; j++){
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	} j=0 ; j=0 j 0 j<q j q j++ j++ j {
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	} {
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	} key = T[j] key T[j] T j l = 0 l 0 r = n r n m = (l+r)/2 m (l+r)/2 (l+r) l r 2 while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    } true {
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    } if(key > S[n-1]){break;} key > S[n-1] key S[n-1] S n-1 n 1 {break;} break; if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		} key == S[m] key S[m] S m {
		    count++;
		    break;
		} count++ count break; if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		} key!=S[m] && l==m key!=S[m] key S[m] S m l==m l m {break;} break; if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		} key < S[m] key S[m] S m {
		    r = m;
		    m = (l+r)/2;
		} r = m r m m = (l+r)/2 m (l+r)/2 (l+r) l r 2 if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		} key > S[m] key S[m] S m {
		    l = m+1;
		    m = (l+r)/2;
		} l = m+1 l m+1 m 1 m = (l+r)/2 m (l+r)/2 (l+r) l r 2 System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
	int i;
	int j;
	int key;
	int count = 0;
	Scanner scan = new Scanner(System.in);

	int n = scan.nextInt();
	int S[] = new int[n];
	for(i=0 ; i<n ; i++){S[i] = scan.nextInt();}

	int q = scan.nextInt();
	int T[] = new int[q];
	for(j=0 ; j<q ; j++){T[j] = scan.nextInt();}

	int l;
	int r;
	int m;
	for(j=0 ; j<q ; j++){
	    key = T[j];
	    l = 0;
	    r = n;
	    m = (l+r)/2;
	    
	    while(true){
		if(key > S[n-1]){break;}
		
		if(key == S[m]){
		    count++;
		    break;
		}
		else if(key!=S[m] && l==m){break;}
		
		else if(key < S[m]){
		    r = m;
		    m = (l+r)/2;
		}
		else if(key > S[m]){
		    l = m+1;
		    m = (l+r)/2;
		}
	    }
	}

	System.out.println(count);

    }
}

