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;
}
*/
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util import java.util.StringTokenizer; StringTokenizer java.util 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;
}
*/
} Main static final PrintWriter out=new PrintWriter(System.out); 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();
}
} main {
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();
}
} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String line=""; 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();
} (line=br.readLine())!=null&&!line.isEmpty() (line=br.readLine())!=null (line=br.readLine()) line br.readLine() br.readLine br null !line.isEmpty() line.isEmpty() line.isEmpty line {
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();
} int ans=0; ans 0 int n=Integer.parseInt(line); n Integer.parseInt(line) Integer.parseInt Integer line int[] a=new int[n]; a new int[n] n StringTokenizer st1=new StringTokenizer(br.readLine()); st1 new StringTokenizer(br.readLine()) for(int i=0;i<n;i++) a[i]=Integer.parseInt(st1.nextToken()); int i=0; int i=0; i 0 i<n i n i++ i++ i a[i]=Integer.parseInt(st1.nextToken()); a[i]=Integer.parseInt(st1.nextToken()) a[i] a i Integer.parseInt(st1.nextToken()) Integer.parseInt Integer st1.nextToken() st1.nextToken st1 int m=Integer.parseInt(br.readLine()); m Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br StringTokenizer st2=new StringTokenizer(br.readLine()); st2 new StringTokenizer(br.readLine()) for(int i=0;i<m;i++){
int b=Integer.parseInt(st2.nextToken());
if(Arrays.binarySearch(a,b)>=0) ans++;
} int i=0; int i=0; i 0 i<m i m i++ i++ i {
int b=Integer.parseInt(st2.nextToken());
if(Arrays.binarySearch(a,b)>=0) ans++;
} {
int b=Integer.parseInt(st2.nextToken());
if(Arrays.binarySearch(a,b)>=0) ans++;
} int b=Integer.parseInt(st2.nextToken()); b Integer.parseInt(st2.nextToken()) Integer.parseInt Integer st2.nextToken() st2.nextToken st2 if(Arrays.binarySearch(a,b)>=0) ans++; Arrays.binarySearch(a,b)>=0 Arrays.binarySearch(a,b) Arrays.binarySearch Arrays a b 0 ans++ ans out.println(ans) out.println out ans out.flush() out.flush out String[] args args
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;
}
*/
}