import java.util.Scanner;

public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
} Main public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    } search {
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    } int mid = (l+r)/2; mid (l+r)/2 (l+r) l r 2 if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        } mid == l || mid == r mid == l mid l mid == r mid r {
            return -1;
        } return -1; -1 1 if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        } S[r] < target || S[l] > target S[r] < target S[r] S r target S[l] > target S[l] S l target {
            return -1;
        } return -1; -1 1 if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        } S[mid] == target S[mid] S mid target {
            return 1;
        } return 1; 1 if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        } S[r] == target S[r] S r target {
            return 1;
        } return 1; 1 if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        } S[l] == target S[l] S l target {
            return 1;
        } return 1; 1 if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        } S[mid] < target S[mid] S mid target {
            return search(mid, r, S, target);
        } return search(mid, r, S, target); search(mid, r, S, target) search mid r S target {
            return search(l, mid, S, target);
        } return search(l, mid, S, target); search(l, mid, S, target) search l mid S target int l l int r r int[] S S int target target public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    } main {
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int S[]; S int T[]; T int 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] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int 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] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int num = 0; num 0 for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        } {
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        } if(search(0, n-1, S, T[i]) == 1){
                num++;
            } search(0, n-1, S, T[i]) == 1 search(0, n-1, S, T[i]) search 0 n-1 n 1 S T[i] T i 1 {
                num++;
            } num++ num System.out.println(num) System.out.println System.out System System.out num String[] args args public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
} public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
} Main
import java.util.Scanner;

public class Main {
    public static int search(int l, int r,int[] S, int target){
        int mid = (l+r)/2;
        if(mid == l || mid == r){
            return -1;
        }
        else if(S[r] < target || S[l] > target){
            return -1;
        }
        else if(S[mid] == target){
            return 1;
        }
        else if(S[r] == target){
            return 1;
        }
        else if(S[l] == target){
            return 1;
        }
        else if(S[mid] < target){
            return search(mid, r, S, target);
        }
        else{
            return search(l, mid, S, target);
        }
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S[];
        int T[];
        int n = sc.nextInt();
        S = new int[n];
        for(int i = 0; i < n; i ++){
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = sc.nextInt();
        }
        int num = 0;
        for(int i = 0; i < q; i++){
            if(search(0, n-1, S, T[i]) == 1){
                num++;
            }
        }
        System.out.println(num);
    }
}
