import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2/17/20
 */

public class Main {
    private int N;
    private int[] increArr;

    private int Q;
    private int[] arrQ;

    public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    }

    private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    }

    public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    private int N;
    private int[] increArr;

    private int Q;
    private int[] arrQ;

    public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    }

    private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    }

    public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    }
} Main private int N; N private int[] increArr; increArr private int Q; Q private int[] arrQ; arrQ public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    } Main {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    } N = sc.nextInt() N sc.nextInt() sc.nextInt sc increArr = new int[N] increArr new int[N] N for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            increArr[i] = sc.nextInt();
        } {
            increArr[i] = sc.nextInt();
        } increArr[i] = sc.nextInt() increArr[i] increArr i sc.nextInt() sc.nextInt sc Q = sc.nextInt() Q sc.nextInt() sc.nextInt sc arrQ = new int[Q] arrQ new int[Q] Q for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < Q i Q i++ i++ i {
            arrQ[i] = sc.nextInt();
        } {
            arrQ[i] = sc.nextInt();
        } arrQ[i] = sc.nextInt() arrQ[i] arrQ i sc.nextInt() sc.nextInt sc Scanner sc sc private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    } binarySearch {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    } int leftIx = 0 leftIx 0 rightIdx = N-1; rightIdx N-1 N 1 while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        } leftIx <= rightIdx leftIx rightIdx {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        } int midIx = leftIx + (rightIdx - leftIx) / 2; midIx leftIx + (rightIdx - leftIx) / 2 leftIx (rightIdx - leftIx) / 2 (rightIdx - leftIx) rightIdx leftIx 2 if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            } increArr[midIx] == targetVal increArr[midIx] increArr midIx targetVal {
                return true;
            } return true; true if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            } increArr[midIx] > targetVal increArr[midIx] increArr midIx targetVal {
                rightIdx = midIx - 1;
            } rightIdx = midIx - 1 rightIdx midIx - 1 midIx 1 {
                leftIx = midIx + 1;
            } leftIx = midIx + 1 leftIx midIx + 1 midIx 1 return false; false int targetVal targetVal public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    } countQinN {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    } int count = 0; count 0 for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        } int targetVal arrQ {
            if (binarySearch(targetVal)) {
                count++;
            }
        } {
            if (binarySearch(targetVal)) {
                count++;
            }
        } if (binarySearch(targetVal)) {
                count++;
            } binarySearch(targetVal) binarySearch targetVal {
                count++;
            } count++ count return count; count public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main m = new Main(sc); m new Main(sc) int res = m.countQinN(); res m.countQinN() m.countQinN m System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    private int N;
    private int[] increArr;

    private int Q;
    private int[] arrQ;

    public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    }

    private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    }

    public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    }
} public class Main {
    private int N;
    private int[] increArr;

    private int Q;
    private int[] arrQ;

    public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    }

    private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    }

    public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    }
} Main
import java.util.Scanner;

/**
 * Created by zhangrunfeng on 2/17/20
 */

public class Main {
    private int N;
    private int[] increArr;

    private int Q;
    private int[] arrQ;

    public Main (Scanner sc) {
        N = sc.nextInt();
        increArr = new int[N];
        for (int i = 0; i < N; i++) {
            increArr[i] = sc.nextInt();
        }

        Q = sc.nextInt();
        arrQ = new int[Q];
        for (int i = 0; i < Q; i++) {
            arrQ[i] = sc.nextInt();
        }
    }

    private boolean binarySearch(int targetVal) {
        int leftIx = 0, rightIdx = N-1;
        while (leftIx <= rightIdx) {
            int midIx = leftIx + (rightIdx - leftIx) / 2;
            if (increArr[midIx] == targetVal) {
                return true;
            } else if (increArr[midIx] > targetVal) {
                rightIdx = midIx - 1;
            } else {
                leftIx = midIx + 1;
            }
        }
        return false;
    }

    public int countQinN() {
        int count = 0;
        for (int targetVal : arrQ) {
            if (binarySearch(targetVal)) {
                count++;
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        int res = m.countQinN();
        System.out.println(res);
    }
}
