import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.sql.Array;
import java.util.*;

public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}

    public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    }
}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.math.BigInteger; BigInteger java.math import java.sql.Array; Array java.sql import java.util.*; util.* java public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}

    public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    }
} Main static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;} gcd {return b>0?gcd(b,a%b):a;} return b>0?gcd(b,a%b):a; b>0?gcd(b,a%b):a b>0 b 0 gcd(b,a%b) gcd b a%b a b a long a a long b b static long lcm (long a, long b) {return a*b/gcd(a,b);} lcm {return a*b/gcd(a,b);} return a*b/gcd(a,b); a*b/gcd(a,b) a*b a b gcd(a,b) gcd a b long a a long b b public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    } main {
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) Set<Long> set = new HashSet<Long>(); set new HashSet<Long>() int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            long S=sc.nextLong();
            set.add(S);
        } {
            long S=sc.nextLong();
            set.add(S);
        } long S=sc.nextLong(); S sc.nextLong() sc.nextLong sc set.add(S) set.add set S long ans=0; ans 0 int q=sc.nextInt(); q sc.nextInt() sc.nextInt sc for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        } {
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        } long T = sc.nextLong(); T sc.nextLong() sc.nextLong sc if (set.contains(T)) {
                ans++;
            } set.contains(T) set.contains set T {
                ans++;
            } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}

    public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    }
} public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}

    public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.sql.Array;
import java.util.*;

public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}

    public static void main(String[] args){
	// write your code here
        Scanner sc=new Scanner(System.in);
        Set<Long> set = new HashSet<Long>();
        int n=sc.nextInt();
        for(int i=0;i<n;i++){
            long S=sc.nextLong();
            set.add(S);
        }
        long ans=0;
        int q=sc.nextInt();
        for(int i=0;i<q;i++){
            long T = sc.nextLong();
            if (set.contains(T)) {
                ans++;
            }
        }
        System.out.println(ans);

    }
}

