import java.util.HashSet;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    }
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    }
} Main public static void main(String[] args) {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    } main {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    } HashSet<Integer> S = new HashSet<Integer>(); S new HashSet<Integer>() HashSet<Integer> T = new HashSet<Integer>(); T new HashSet<Integer>() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++)
	S.add(sc.nextInt()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i S.add(sc.nextInt()); S.add(sc.nextInt()) S.add S sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc for(int i = 0; i < q; i++)
	T.add(sc.nextInt()); int i = 0; int i = 0; i 0 i < q i q i++ i++ i T.add(sc.nextInt()); T.add(sc.nextInt()) T.add T sc.nextInt() sc.nextInt sc int count = 0; count 0 for(Integer T1 : T)
	if(S.contains(T1)) count++; Integer T1 T if(S.contains(T1)) count++; if(S.contains(T1)) count++; S.contains(T1) S.contains S T1 count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
    public static void main(String[] args) {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    }
} public class Main {
    public static void main(String[] args) {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    }
} Main
import java.util.HashSet;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    HashSet<Integer> S = new HashSet<Integer>();
    HashSet<Integer> T = new HashSet<Integer>();
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    for(int i = 0; i < n; i++)
	S.add(sc.nextInt());
    int q = sc.nextInt();
    for(int i = 0; i < q; i++)
	T.add(sc.nextInt());
    int count = 0;
    for(Integer T1 : T)
	if(S.contains(T1)) count++;
    System.out.println(count);
    }
}
