import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	}

}
 import java.util.Arrays; Arrays java.util import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	} main {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) scanner.nextLine() scanner.nextLine scanner HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" "))); set1 new HashSet<>(Arrays.asList(scanner.nextLine().split(" "))) scanner.nextLine() scanner.nextLine scanner int count=0; count 0 for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		} String str scanner.nextLine().split(" ") scanner.nextLine().split scanner.nextLine() scanner.nextLine scanner " " {
			if(set1.contains(str)) {
				count++;
			}
		} {
			if(set1.contains(str)) {
				count++;
			}
		} if(set1.contains(str)) {
				count++;
			} set1.contains(str) set1.contains set1 str {
				count++;
			} 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) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	}

} Main
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		scanner.nextLine();
		HashSet<String> set1 = new HashSet<>(Arrays.asList(scanner.nextLine().split(" ")));
		scanner.nextLine();
		int count=0;
		for(String str: scanner.nextLine().split(" ")) {
			if(set1.contains(str)) {
				count++;
			}
		}
		System.out.println(count);

	}

}

