import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
 
class Main{
 
static final PrintWriter out=new PrintWriter(System.out);
 
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int ans=0;
int n=Integer.parseInt(line);
int[] a=new int[n];
StringTokenizer st1=new StringTokenizer(br.readLine());
for(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken());
int m=Integer.parseInt(br.readLine());
StringTokenizer st2=new StringTokenizer(br.readLine());
/**
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(binarySearch(a,b)>=0) ans++;
}
*/
for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(Arrays.binarySearch(a,b)>=0) ans++;
}
out.println(ans);
out.flush();
}
}
 
/**
private static int binarySearch(int[] a,int b){
int lb=0;
int ub=a.length;
while(ub>lb){
int mid=(lb+ub)/2;
if(a[mid]==b) return mid;
else if(a[mid]>b) ub=mid;
else lb=mid+1;
}
return -1;
}
*/
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz