import java.util.*;

public class Main {
    public static int n = 0;
    public static int[] data = new int[100000];
    public static int q = 0;
    public static int[] targets = new int[50000];

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    }

    public static int calc(int left, int right, int target) {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    }
} import java.util.*; util.* java public class Main {
    public static int n = 0;
    public static int[] data = new int[100000];
    public static int q = 0;
    public static int[] targets = new int[50000];

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    }

    public static int calc(int left, int right, int target) {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    }
} Main public static int n = 0; n 0 public static int[] data = new int[100000]; data new int[100000] 100000 public static int q = 0; q 0 public static int[] targets = new int[50000]; targets new int[50000] 50000 public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    } main {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    } Scanner num = new Scanner(System.in); num new Scanner(System.in) n = num.nextInt() n num.nextInt() num.nextInt num for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            data[i] = num.nextInt();
        } {
            data[i] = num.nextInt();
        } data[i] = num.nextInt() data[i] data i num.nextInt() num.nextInt num q = num.nextInt() q num.nextInt() num.nextInt num for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            targets[i] = num.nextInt();
        } {
            targets[i] = num.nextInt();
        } targets[i] = num.nextInt() targets[i] targets i num.nextInt() num.nextInt num if(num != null) {
            num.close();
        } num != null num null {
            num.close();
        } num.close() num.close num int result = 0; result 0 for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            result += calc(0, n - 1, targets[i]);
        } {
            result += calc(0, n - 1, targets[i]);
        } result += calc(0, n - 1, targets[i]) result calc(0, n - 1, targets[i]) calc 0 n - 1 n 1 targets[i] targets i System.out.println(result) System.out.println System.out System System.out result String[] args args public static int calc(int left, int right, int target) {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    } calc {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    } if(left > right) {
            return 0;
        } left > right left right {
            return 0;
        } return 0; 0 if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        } data[(left + right) / 2] == target data[(left + right) / 2] data (left + right) / 2 (left + right) left right 2 target {
            return 1;
        } return 1; 1 if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        } data[(left + right) / 2] > target data[(left + right) / 2] data (left + right) / 2 (left + right) left right 2 target {
            return calc(left, (left + right) / 2 - 1, target);
        } return calc(left, (left + right) / 2 - 1, target); calc(left, (left + right) / 2 - 1, target) calc left (left + right) / 2 - 1 (left + right) / 2 (left + right) left right 2 1 target {
            return calc((left + right) / 2 + 1, right, target);
        } return calc((left + right) / 2 + 1, right, target); calc((left + right) / 2 + 1, right, target) calc (left + right) / 2 + 1 (left + right) / 2 (left + right) left right 2 1 right target int left left int right right int target target public class Main {
    public static int n = 0;
    public static int[] data = new int[100000];
    public static int q = 0;
    public static int[] targets = new int[50000];

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    }

    public static int calc(int left, int right, int target) {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    }
} public class Main {
    public static int n = 0;
    public static int[] data = new int[100000];
    public static int q = 0;
    public static int[] targets = new int[50000];

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    }

    public static int calc(int left, int right, int target) {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    }
} Main
import java.util.*;

public class Main {
    public static int n = 0;
    public static int[] data = new int[100000];
    public static int q = 0;
    public static int[] targets = new int[50000];

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        n = num.nextInt();

        for(int i = 0; i < n; i++) {
            data[i] = num.nextInt();
        }

        q = num.nextInt();

        for(int i = 0; i < q; i++) {
            targets[i] = num.nextInt();
        }

        if(num != null) {
            num.close();
        }
        int result = 0;

        for(int i = 0; i < q; i++) {
            result += calc(0, n - 1, targets[i]);
        }

        System.out.println(result);
    }

    public static int calc(int left, int right, int target) {
        if(left > right) {
            return 0;
        }
        
        if(data[(left + right) / 2] == target) {
            return 1;
        } else if(data[(left + right) / 2] > target) {
            return calc(left, (left + right) / 2 - 1, target);
        } else {
            return calc((left + right) / 2 + 1, right, target);
        }
    }
}
