import java.util.*;

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

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