import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main{
    public static void main(String[] args){
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    }
} Main public static void main(String[] args){
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    } main {
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    } 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 Arrays.sort(T) Arrays.sort Arrays T int Sum = 0; Sum 0 for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        } {
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        } for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            } {
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            } if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                } S[j] == T[i] S[j] S j T[i] T i {
                    Sum++;
                    break;
                } Sum++ Sum break; if(S[j] > T[i]){
                    break;
                } S[j] > T[i] S[j] S j T[i] T i {
                    break;
                } break; System.out.println(Sum) System.out.println System.out System System.out Sum sc.close() sc.close sc String[] args args public class Main{
    public static void main(String[] args){
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    }
} public class Main{
    public static void main(String[] args){
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    }
} Main
import java.util.Scanner;
import java.util.Arrays;

public class Main{
    public static void main(String[] args){
        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();
        }
        Arrays.sort(T);
        int Sum = 0;
        for(int i = 0; i < q; i++){
            for(int j = 0; j < n; j++){
                if(S[j] == T[i]){
                    Sum++;
                    break;
                }else if(S[j] > T[i]){
                    break;
                }
            }
        }
        System.out.println(Sum);
        sc.close();
    }
}
