

import java.util.Scanner;

public class Main {
    static int[] A = new int[1000000];
    static int n;

    public static int binarySearch(int key) {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    }
}
 import java.util.Scanner; Scanner java.util public class Main {
    static int[] A = new int[1000000];
    static int n;

    public static int binarySearch(int key) {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    }
} Main static int[] A = new int[1000000]; A new int[1000000] 1000000 static int n; n public static int binarySearch(int key) {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    } binarySearch {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    } int left = 0; left 0 int right = n; right n int mid; mid while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        } left < right left right {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        } mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(key == A[mid]) return 1; key == A[mid] key A[mid] A mid return 1; 1 if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid; key > A[mid] key A[mid] A mid left = mid + 1 left mid + 1 mid 1 if(key < A[mid]) right = mid; key < A[mid] key A[mid] A mid right = mid right mid return 0; 0 int key key public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    } main {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc int i i q q k k sum = 0; sum 0 for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        } i = 0; 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 q = sc.nextInt() q sc.nextInt() sc.nextInt sc for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        } i = 0; i = 0 i 0 i < q i q i++ i++ i {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        } {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        } k = sc.nextInt() k sc.nextInt() sc.nextInt sc if(binarySearch(k) == 1) sum++; binarySearch(k) == 1 binarySearch(k) binarySearch k 1 sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
    static int[] A = new int[1000000];
    static int n;

    public static int binarySearch(int key) {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    }
} public class Main {
    static int[] A = new int[1000000];
    static int n;

    public static int binarySearch(int key) {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    }
} Main


import java.util.Scanner;

public class Main {
    static int[] A = new int[1000000];
    static int n;

    public static int binarySearch(int key) {
        int left = 0;
        int right = n;
        int mid;

        while(left < right)
        {
            mid = (left + right) / 2;
            if(key == A[mid]) return 1;
            if(key > A[mid]) left = mid + 1;
            else if(key < A[mid]) right = mid;
        }
        return 0;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        int i, q, k, sum = 0;
        for(i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        q = sc.nextInt();
        for(i = 0; i < q; i++) {
            k = sc.nextInt();
            if(binarySearch(k) == 1) sum++;
        }
        System.out.println(sum);
    }
}

