import javax.sound.midi.Soundbank;
import java.util.Scanner;

import static java.lang.System.currentTimeMillis;
import static java.lang.System.out;
import static java.lang.System.setOut;

public class Main {

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

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    }

    static  boolean isContain (int num , int[] arr){
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    }
} import javax.sound.midi.Soundbank; Soundbank javax.sound.midi import java.util.Scanner; Scanner java.util import static java.lang.System.currentTimeMillis; import static java.lang.System.currentTimeMillis; import static java.lang.System.currentTimeMillis; import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.out; import static java.lang.System.setOut; import static java.lang.System.setOut; import static java.lang.System.setOut; public class Main {

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

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    }

    static  boolean isContain (int num , int[] arr){
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    } main {
        Scanner scanner = new Scanner(System.in);

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int size = (scanner.nextInt()); size (scanner.nextInt()) scanner.nextInt scanner int [] S= new int[size]; S new int[size] size for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            S[i] = scanner.nextInt();
        } {
            S[i] = scanner.nextInt();
        } S[i] = scanner.nextInt() S[i] S i scanner.nextInt() scanner.nextInt scanner int ansSize = (scanner.nextInt()); ansSize (scanner.nextInt()) scanner.nextInt scanner int[] T = new int[ansSize]; T new int[ansSize] ansSize for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < ansSize i ansSize i++ i++ i {
            T[i] = scanner.nextInt();
        } {
            T[i] = scanner.nextInt();
        } T[i] = scanner.nextInt() T[i] T i scanner.nextInt() scanner.nextInt scanner double roopCount = 0; roopCount 0 int count = 0; count 0 for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        } int i = 0; int i = 0; i 0 i < ansSize i ansSize i++ i++ i {
            if(isContain(T[i],S)){
                count++;
            }
        } {
            if(isContain(T[i],S)){
                count++;
            }
        } if(isContain(T[i],S)){
                count++;
            } isContain(T[i],S) isContain T[i] T i S {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args static  boolean isContain (int num , int[] arr){
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    } isContain {
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    } int head = 0; head 0 int tail = arr.length-1; tail arr.length-1 arr.length arr arr.length 1 int mid  = (head+tail)/2; mid (head+tail)/2 (head+tail) head tail 2 while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        } mid != head mid head {
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        } if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            } arr[mid] == num arr[mid] arr mid num {
                return  true;
            } return  true; true if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            } arr[mid]< num arr[mid] arr mid num {
                head = mid;
            } head = mid head mid if(arr[mid] > num){
                tail = mid;
            } arr[mid] > num arr[mid] arr mid num {
                tail = mid;
            } tail = mid tail mid mid = (tail+head)/2 mid (tail+head)/2 (tail+head) tail head 2 return arr[mid]==num || arr[tail]==num; arr[mid]==num || arr[tail]==num arr[mid]==num arr[mid] arr mid num arr[tail]==num arr[tail] arr tail num int num num int[] arr arr public class Main {

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

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    }

    static  boolean isContain (int num , int[] arr){
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    }
} public class Main {

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

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    }

    static  boolean isContain (int num , int[] arr){
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    }
} Main
import javax.sound.midi.Soundbank;
import java.util.Scanner;

import static java.lang.System.currentTimeMillis;
import static java.lang.System.out;
import static java.lang.System.setOut;

public class Main {

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

        //探索対象を取得
        int size = (scanner.nextInt());
        int [] S= new int[size];
        for (int i = 0; i < size; i++) {
            S[i] = scanner.nextInt();
        }

        //探索する値を取得
        int ansSize = (scanner.nextInt());
        int[] T = new int[ansSize];
        for (int i = 0; i < ansSize; i++) {
            T[i] = scanner.nextInt();
        }

        //System.out.println("読み込み完了！");
        double roopCount = 0;
        int count = 0;
        //探索用のアルゴリズム
        for (int i = 0; i < ansSize; i++) {
            if(isContain(T[i],S)){
                count++;
            }
        }

        System.out.println(count);
    }

    static  boolean isContain (int num , int[] arr){
        int head = 0;
        int tail = arr.length-1;
        int mid  = (head+tail)/2;

        while (mid != head){
            if(arr[mid] == num){
                return  true;
            }
            else if(arr[mid]< num){
                head = mid;
            }
            else if(arr[mid] > num){
                tail = mid;
            }
            mid = (tail+head)/2;
        }
        return arr[mid]==num || arr[tail]==num;

    }
}
