import java.util.Scanner;

public class Main {
    public static int s[];
    public static int n;
    public static int count = 0;
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        s = new int[n];
        int right = n - 1;
        for(int i = 0; i < n; i++){
            s[i] = scan.nextInt();
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int m = scan.nextInt();
            solve(m, right, 0);
        }

        System.out.println(count);
        scan.close();
    }

    public static void solve(int key, int right, int left){
        int m = (left + right) / 2;
        while(left <= right) {
            if (s[m] == key) {
                count = count + 1;
                return;
            } else if (s[m] > key) {
                right = m - 1;
            } else {
                 left = m + 1;
            }
            m = (left + right) / 2;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static int s[];
    public static int n;
    public static int count = 0;
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        s = new int[n];
        int right = n - 1;
        for(int i = 0; i < n; i++){
            s[i] = scan.nextInt();
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int m = scan.nextInt();
            solve(m, right, 0);
        }

        System.out.println(count);
        scan.close();
    }

    public static void solve(int key, int right, int left){
        int m = (left + right) / 2;
        while(left <= right) {
            if (s[m] == key) {
                count = count + 1;
                return;
            } else if (s[m] > key) {
                right = m - 1;
            } else {
                 left = m + 1;
            }
            m = (left + right) / 2;
        }
    }
} Main public static int s[]; s public static int n; n public static int count = 0; count 0 public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        s = new int[n];
        int right = n - 1;
        for(int i = 0; i < n; i++){
            s[i] = scan.nextInt();
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int m = scan.nextInt();
            solve(m, right, 0);
        }

        System.out.println(count);
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        s = new int[n];
        int right = n - 1;
        for(int i = 0; i < n; i++){
            s[i] = scan.nextInt();
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int m = scan.nextInt();
            solve(m, right, 0);
        }

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

        System.out.println(count);
        scan.close();
    }

    public static void solve(int key, int right, int left){
        int m = (left + right) / 2;
        while(left <= right) {
            if (s[m] == key) {
                count = count + 1;
                return;
            } else if (s[m] > key) {
                right = m - 1;
            } else {
                 left = m + 1;
            }
            m = (left + right) / 2;
        }
    }
} public class Main {
    public static int s[];
    public static int n;
    public static int count = 0;
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        s = new int[n];
        int right = n - 1;
        for(int i = 0; i < n; i++){
            s[i] = scan.nextInt();
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int m = scan.nextInt();
            solve(m, right, 0);
        }

        System.out.println(count);
        scan.close();
    }

    public static void solve(int key, int right, int left){
        int m = (left + right) / 2;
        while(left <= right) {
            if (s[m] == key) {
                count = count + 1;
                return;
            } else if (s[m] > key) {
                right = m - 1;
            } else {
                 left = m + 1;
            }
            m = (left + right) / 2;
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static int s[];
    public static int n;
    public static int count = 0;
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        n = scan.nextInt();
        s = new int[n];
        int right = n - 1;
        for(int i = 0; i < n; i++){
            s[i] = scan.nextInt();
        }
        int q = scan.nextInt();
        for(int i = 0; i < q; i++){
            int m = scan.nextInt();
            solve(m, right, 0);
        }

        System.out.println(count);
        scan.close();
    }

    public static void solve(int key, int right, int left){
        int m = (left + right) / 2;
        while(left <= right) {
            if (s[m] == key) {
                count = count + 1;
                return;
            } else if (s[m] > key) {
                right = m - 1;
            } else {
                 left = m + 1;
            }
            m = (left + right) / 2;
        }
    }
}
