import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    }

    static boolean binarySearch(int[] a, int x){
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    }

    static boolean binarySearch(int[] a, int x){
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    }
} Main public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    } main {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] s = new int[n]; s new int[n] n for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            s[i] = stdIn.nextInt();
        } {
            s[i] = stdIn.nextInt();
        } s[i] = stdIn.nextInt() s[i] s i stdIn.nextInt() stdIn.nextInt stdIn int q = stdIn.nextInt(); q stdIn.nextInt() stdIn.nextInt stdIn int[] t = new int[q]; t new int[q] q for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            t[i] = stdIn.nextInt();
        } {
            t[i] = stdIn.nextInt();
        } t[i] = stdIn.nextInt() t[i] t i stdIn.nextInt() stdIn.nextInt stdIn java.util.Arrays.sort(s) java.util.Arrays.sort java.util.Arrays java.util java java.util java.util.Arrays s int counter = 0; counter 0 for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            if(binarySearch(s, t[i])){
                counter++;
            }
        } {
            if(binarySearch(s, t[i])){
                counter++;
            }
        } if(binarySearch(s, t[i])){
                counter++;
            } binarySearch(s, t[i]) binarySearch s t[i] t i {
                counter++;
            } counter++ counter System.out.println(counter) System.out.println System.out System System.out counter String[] args args static boolean binarySearch(int[] a, int x){
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    } binarySearch {
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    } int from = 0; from 0 int to = a.length-1; to a.length-1 a.length a a.length 1 int mid; mid do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to); x != a[mid] && from <= to x != a[mid] x a[mid] a mid from <= to from to {
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        } mid = (from + to) / 2 mid (from + to) / 2 (from + to) from to 2 if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            } x < a[mid] x a[mid] a mid {
                to = mid - 1;
            } to = mid - 1 to mid - 1 mid 1 {
                from = mid+1;
            } from = mid+1 from mid+1 mid 1 return (a[mid] == x); (a[mid] == x) a[mid] a mid x int[] a a int x x public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    }

    static boolean binarySearch(int[] a, int x){
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    }
} public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    }

    static boolean binarySearch(int[] a, int x){
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] s = new int[n];
        for(int i=0; i<n; i++){
            s[i] = stdIn.nextInt();
        }

        int q = stdIn.nextInt();
        int[] t = new int[q];
        for(int i=0; i<q; i++){
            t[i] = stdIn.nextInt();
        }

        java.util.Arrays.sort(s);

        int counter = 0;
        for(int i=0; i<q; i++){
            if(binarySearch(s, t[i])){
                counter++;
            }
        }

        System.out.println(counter);
    }

    static boolean binarySearch(int[] a, int x){
        int from = 0;
        int to = a.length-1;
        int mid;
        do{
            mid = (from + to) / 2;
            if(x < a[mid]){
                to = mid - 1;
            }else{
                from = mid+1;
            }
        }while(x != a[mid] && from <= to);

        return (a[mid] == x);
    }
}
