import java.util.*;

public class Main{
    public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    }

    public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    }
}
 import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    }

    public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    }
} Main public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    } main {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    } int count = 0; count 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] A = new int[100000 + 1]; A new int[100000 + 1] 100000 + 1 100000 1 for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
            A[i] = sc.nextInt();
        } {
            A[i] = sc.nextInt();
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc Arrays.sort(A) Arrays.sort Arrays A int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] Key = new int[100000]; Key new int[100000] 100000 for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        } {
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        } Key[i] = sc.nextInt() Key[i] Key i sc.nextInt() sc.nextInt sc if(binarySearch(A, Key[i]) == 1){
                count++;
            } binarySearch(A, Key[i]) == 1 binarySearch(A, Key[i]) binarySearch A Key[i] Key i 1 {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    } binarySearch {
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    } int left = 0; left 0 int right = A.length; right A.length A A.length int YesNo = 0; YesNo 0 while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        } left < right left right {
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        } int mid = (int)Math.ceil((left + right)/2); mid (int)Math.ceil((left + right)/2) Math.ceil Math (left + right)/2 (left + right) left right 2 if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            } Key > A[mid] Key A[mid] A mid {
                left = mid + 1;   //注意需要加一 因为是向下取整数
            } left = mid + 1 left mid + 1 mid 1 if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            } Key == A[mid] Key A[mid] A mid {
                return 1;
            } return 1; 1 {
                right = mid;
            } right = mid right mid return YesNo; YesNo int[] A A int Key Key public class Main{
    public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    }

    public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    }
} public class Main{
    public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    }

    public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        int count = 0;
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] A = new int[100000 + 1];
        for(int i = 0; i<n; i++){
            A[i] = sc.nextInt();
        }

        Arrays.sort(A);
        int q = sc.nextInt();
        int[] Key = new int[100000];
        for(int i = 0; i < q; i++){
            Key[i] = sc.nextInt();
            if(binarySearch(A, Key[i]) == 1){
                count++;
            }
        }
        System.out.println(count);

    }

    public static int binarySearch(int[] A, int Key){
        int left = 0;
        int right = A.length;
        int YesNo = 0;
        while(left < right){
            int mid = (int)Math.ceil((left + right)/2);
            if(Key > A[mid]){
                left = mid + 1;   //注意需要加一 因为是向下取整数
            }else if(Key == A[mid]){
                return 1;
            }else{
                right = mid;
            }
        }
        return YesNo;

    }
}

