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

class Main { 
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int[] S = new int[n];
        for (int i = 0; n != 0; i++) {
            S[i] = in.nextInt();
            n--;
        }
        
        int q = in.nextInt();
        int[] T = new int[q];
        for (int i = 0; q != 0; i++) {
            T[i] = in.nextInt();
            q--;
        }
        
        System.out.println(include(S, T));
    }
    
    static int include(int[] S, int[] T) {
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) >= 0) count++;
        }
        return count;
    }
    static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util class Main { 
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int[] S = new int[n];
        for (int i = 0; n != 0; i++) {
            S[i] = in.nextInt();
            n--;
        }
        
        int q = in.nextInt();
        int[] T = new int[q];
        for (int i = 0; q != 0; i++) {
            T[i] = in.nextInt();
            q--;
        }
        
        System.out.println(include(S, T));
    }
    
    static int include(int[] S, int[] T) {
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) >= 0) count++;
        }
        return count;
    }
    static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int[] S = new int[n];
        for (int i = 0; n != 0; i++) {
            S[i] = in.nextInt();
            n--;
        }
        
        int q = in.nextInt();
        int[] T = new int[q];
        for (int i = 0; q != 0; i++) {
            T[i] = in.nextInt();
            q--;
        }
        
        System.out.println(include(S, T));
    } main {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int[] S = new int[n];
        for (int i = 0; n != 0; i++) {
            S[i] = in.nextInt();
            n--;
        }
        
        int q = in.nextInt();
        int[] T = new int[q];
        for (int i = 0; q != 0; i++) {
            T[i] = in.nextInt();
            q--;
        }
        
        System.out.println(include(S, T));
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] S = new int[n]; S new int[n] n for (int i = 0; n != 0; i++) {
            S[i] = in.nextInt();
            n--;
        } int i = 0; int i = 0; i 0 n != 0 n 0 i++ i++ i {
            S[i] = in.nextInt();
            n--;
        } {
            S[i] = in.nextInt();
            n--;
        } S[i] = in.nextInt() S[i] S i in.nextInt() in.nextInt in n-- n int q = in.nextInt(); q in.nextInt() in.nextInt in int[] T = new int[q]; T new int[q] q for (int i = 0; q != 0; i++) {
            T[i] = in.nextInt();
            q--;
        } int i = 0; int i = 0; i 0 q != 0 q 0 i++ i++ i {
            T[i] = in.nextInt();
            q--;
        } {
            T[i] = in.nextInt();
            q--;
        } T[i] = in.nextInt() T[i] T i in.nextInt() in.nextInt in q-- q System.out.println(include(S, T)) System.out.println System.out System System.out include(S, T) include S T String[] args args static int include(int[] S, int[] T) {
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) >= 0) count++;
        }
        return count;
    } include {
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) >= 0) count++;
        }
        return count;
    } int count = 0; count 0 for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) >= 0) count++;
        } int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
            if (binarySearch(S, T[i]) >= 0) count++;
        } {
            if (binarySearch(S, T[i]) >= 0) count++;
        } if (binarySearch(S, T[i]) >= 0) count++; binarySearch(S, T[i]) >= 0 binarySearch(S, T[i]) binarySearch S T[i] T i 0 count++ count return count; count int[] S S int[] T T static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    } binarySearch {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    } int lo = 0; lo 0 int hi = a.length - 1; hi a.length - 1 a.length a a.length 1 while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        } lo <= hi lo hi {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        } int mid = lo + (hi - lo) / 2; mid lo + (hi - lo) / 2 lo (hi - lo) / 2 (hi - lo) hi lo 2 if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid; key < a[mid] key a[mid] a mid hi = mid - 1 hi mid - 1 mid 1 if (key > a[mid]) lo = mid + 1;
            else return mid; key > a[mid] key a[mid] a mid lo = mid + 1 lo mid + 1 mid 1 return mid; mid return -1; -1 1 int[] a a int key key
import java.util.Scanner;
import java.util.Arrays;

class Main { 
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        int n = in.nextInt();
        int[] S = new int[n];
        for (int i = 0; n != 0; i++) {
            S[i] = in.nextInt();
            n--;
        }
        
        int q = in.nextInt();
        int[] T = new int[q];
        for (int i = 0; q != 0; i++) {
            T[i] = in.nextInt();
            q--;
        }
        
        System.out.println(include(S, T));
    }
    
    static int include(int[] S, int[] T) {
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) >= 0) count++;
        }
        return count;
    }
    static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            // Key is in a[lo..hi] or not present.
            int mid = lo + (hi - lo) / 2;
            if      (key < a[mid]) hi = mid - 1;
            else if (key > a[mid]) lo = mid + 1;
            else return mid;
        }
        return -1;
    }
}