import java.util.*;

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

public class Main {
    static int calu(int n, int m, int A[], int S[]) {
        int count=0;
        for(int i=0;i<m;i++){
            count+=bsearch(S[i],A,0,n);
        }
        return count;
    }
    static int bsearch(int si,int A[],int left,int right)
    {   
        while (left < right){
            int mid = (left + right) / 2;
            if (A[mid] == si) return 1;
            else if (si < 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[] A,S;
        A = new int[n]; 
        for(int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }
        int m = sc.nextInt();
        S = new int[m];
        for(int i = 0; i < m; i++) {
            S[i] = sc.nextInt();
        }
        System.out.println(calu(n,m,A,S));
        sc.close();
    }
}
