import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    }

    public static boolean binarySearch(int[] arr, int target, int left, int right) {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    }
} import java.io.*; io.* java class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    }

    public static boolean binarySearch(int[] arr, int target, int left, int right) {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] input; input int i; i int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br input = br.readLine().split(" ") input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] s = new int[n]; s new int[n] n for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        } i = 0; i = 0 i 0 i < n i n i++ i++ i {
            s[i] = Integer.parseInt(input[i]);
        } {
            s[i] = Integer.parseInt(input[i]);
        } s[i] = Integer.parseInt(input[i]) s[i] s i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br input = br.readLine().split(" ") input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] t = new int[q]; t new int[q] q for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        } i = 0; i = 0 i 0 i < q i q i++ i++ i {
            t[i] = Integer.parseInt(input[i]);
        } {
            t[i] = Integer.parseInt(input[i]);
        } t[i] = Integer.parseInt(input[i]) t[i] t i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i int count = 0; count 0 for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        } i = 0; i = 0 i 0 i < q i q i++ i++ i {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        } {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        } if (binarySearch(s, t[i], 0, n - 1)) count++; binarySearch(s, t[i], 0, n - 1) binarySearch s t[i] t i 0 n - 1 n 1 count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public static boolean binarySearch(int[] arr, int target, int left, int right) {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    } binarySearch {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    } if (left > right) return false; left > right left right return false; false int m = (left + right) / 2; m (left + right) / 2 (left + right) left right 2 if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true; arr[m] < target arr[m] arr m target return binarySearch(arr, target, m + 1, right); binarySearch(arr, target, m + 1, right) binarySearch arr target m + 1 m 1 right if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true; arr[m] > target arr[m] arr m target return binarySearch(arr, target, left, m - 1); binarySearch(arr, target, left, m - 1) binarySearch arr target left m - 1 m 1 return true; true int[] arr arr int target target int left left int right right
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        String[] input;
        int i;

        int n = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] s = new int[n];
        for (i = 0; i < n; i++) {
            s[i] = Integer.parseInt(input[i]);
        }

        int q = Integer.parseInt(br.readLine());
        input = br.readLine().split(" ");
        int[] t = new int[q];
        for (i = 0; i < q; i++) {
            t[i] = Integer.parseInt(input[i]);
        }

        int count = 0;
        for (i = 0; i < q; i++) {
            if (binarySearch(s, t[i], 0, n - 1)) count++;
        }

        System.out.println(count);
    }

    public static boolean binarySearch(int[] arr, int target, int left, int right) {
        if (left > right) return false;

        int m = (left + right) / 2;
        if (arr[m] < target) return binarySearch(arr, target, m + 1, right);
        else if (arr[m] > target) return binarySearch(arr, target, left, m - 1);
        else return true;
    }
}