import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
 
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    }
 
} import java.util.*; util.* java import java.io.*; io.* java import static java.util.Arrays.*; import static java.util.Arrays.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.util.Collections.*; import static java.util.Collections.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import java.util.Scanner; Scanner java.util public class Main {
 
    public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    }
 
} Main public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    } main {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    } int i i j j n n q q a; a a=0 a 0 Scanner scan=new Scanner(System.in); scan new Scanner(System.in) 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 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 for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        } j=0; j=0 j 0 j<q j q j++ j++ j {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        } {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        } for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            } i=0; i=0 i 0 i<n i n i++ i++ i {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            } {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            } if(t[j]==s[i])
                {
                    a++;
                    break;
                } t[j]==s[i] t[j] t j s[i] s i {
                    a++;
                    break;
                } a++ a break; System.out.println(a) System.out.println System.out System System.out a String[] args args public class Main {
 
    public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    }
 
} public class Main {
 
    public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    }
 
} Main
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;
 
 
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        // TODO ?????????????????????????????????????????????
        int i,j,n,q,a;
        a=0;
        Scanner scan=new Scanner(System.in);
        n=scan.nextInt();
        int s[]=new int [n];
        for(i=0;i<n;i++)
        {
            s[i]=scan.nextInt();
        }
        q=scan.nextInt();
        int t[]=new int [q];
        for(j=0;j<q;j++)
        {
            t[j]=scan.nextInt();
        }
        for(j=0;j<q;j++)
        {
            for(i=0;i<n;i++)
            {
                if(t[j]==s[i])
                {
                    a++;
                    break;
                }
            }
        }
        System.out.println(a);
    }
 
}