import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }    
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }    
} Main public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    } main {
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[]S = new int[n]; S new int[n] n for(int i=0;i<n;i++){
            S[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            S[i] = sc.nextInt();
        } {
            S[i] = sc.nextInt();
        } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for(int i=0;i<q;i++){
            T[i] = sc.nextInt();
        } int i=0; int i=0; i 0 i<q i q 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 count = 0; count 0 for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        } {
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        } for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            } int j=0; int j=0; j 0 j<n j n j++ j++ j {
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            } {
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            } if(T[i] == S[j]){
                    count++;
                    break;
                } T[i] == S[j] T[i] T i S[j] S j {
                    count++;
                    break;
                } count++ count break; System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main{
    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }    
} public class Main{
    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }    
} Main
import java.io.*;
import java.util.*;



public class Main{
    public static void main(String[] args)throws IOException{
        //BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        //String str;
        Scanner sc = new Scanner(System.in);

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

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

        int count = 0;
        for(int i=0;i<q;i++){
            for(int j=0;j<n;j++){
                if(T[i] == S[j]){
                    count++;
                    break;
                }
            }
        }

        System.out.println(count);
    }    
}
