import java.util.Scanner;
public class Main {
    public static int n;
    public static int S[];
    public static int q;
    public static int T[];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    }
    private static boolean binary_search(int key){
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static int n;
    public static int S[];
    public static int q;
    public static int T[];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    }
    private static boolean binary_search(int key){
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    }
} Main public static int n; n public static int S[]; S public static int q; q public static int T[]; T public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n=sc.nextInt() n sc.nextInt() sc.nextInt sc S=new int[n] S new int[n] n for(int i=0;i<n;i++) S[i]=sc.nextInt(); int i=0; int i=0; i 0 i<n i n i++ i++ i S[i]=sc.nextInt(); S[i]=sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc q=sc.nextInt() q sc.nextInt() sc.nextInt sc T=new int[q] T new int[q] q for(int i=0;i<q;i++) T[i]=sc.nextInt(); int i=0; int i=0; i 0 i<q i q i++ i++ i T[i]=sc.nextInt(); T[i]=sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int count=0; count 0 for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            if(binary_search(T[i])){
            count++;
            }
        } {
            if(binary_search(T[i])){
            count++;
            }
        } if(binary_search(T[i])){
            count++;
            } binary_search(T[i]) binary_search T[i] T i {
            count++;
            } count++ count System.out.println (count) System.out.println System.out System System.out count sc.close() sc.close sc String[] args args private static boolean binary_search(int key){
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    } binary_search {
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    } int left=0; left 0 int right=n-1; right n-1 n 1 while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        } right>=left right left {
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        } int mid=(left+right)/2; mid (left+right)/2 (left+right) left right 2 if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1; S[mid]==key S[mid] S mid key return true; true if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1; S[mid] > key S[mid] S mid key right = mid - 1 right mid - 1 mid 1 if (S[mid] < key) left = mid + 1; S[mid] < key S[mid] S mid key left = mid + 1 left mid + 1 mid 1 return false; false int key key public class Main {
    public static int n;
    public static int S[];
    public static int q;
    public static int T[];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    }
    private static boolean binary_search(int key){
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    }
} public class Main {
    public static int n;
    public static int S[];
    public static int q;
    public static int T[];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    }
    private static boolean binary_search(int key){
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    }
} Main
import java.util.Scanner;
public class Main {
    public static int n;
    public static int S[];
    public static int q;
    public static int T[];
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        n=sc.nextInt();
        S=new int[n];
        for(int i=0;i<n;i++) S[i]=sc.nextInt();
        q=sc.nextInt();
        T=new int[q];
        for(int i=0;i<q;i++) T[i]=sc.nextInt();
        int count=0;
        for(int i=0;i<q;i++){
            if(binary_search(T[i])){
            count++;
            }
        }
        System.out.println (count);
        sc.close();
    }
    private static boolean binary_search(int key){
        int left=0;
        int right=n-1;
        while(right>=left){
            int mid=(left+right)/2;
            if(S[mid]==key) return true;
            else if (S[mid] > key) right = mid - 1;
            else if (S[mid] < key) left = mid + 1;
        }
        return false;
    }
}
