import java.util.*;
import java.io.*;

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

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	}
} 
 import java.util.*; util.* java import java.io.*; io.* java public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int[] s = new int[n];
		
		for (int i = 0; i < n; i ++) {
			s[i]  = scanner.nextInt();
		}
		
		int q = scanner.nextInt();
		int c = 0;

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int[] s = new int[n];
		
		for (int i = 0; i < n; i ++) {
			s[i]  = scanner.nextInt();
		}
		
		int q = scanner.nextInt();
		int c = 0;

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	} main {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int[] s = new int[n];
		
		for (int i = 0; i < n; i ++) {
			s[i]  = scanner.nextInt();
		}
		
		int q = scanner.nextInt();
		int c = 0;

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] s = new int[n]; s new int[n] n for (int i = 0; i < n; i ++) {
			s[i]  = scanner.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i ++ i ++ i {
			s[i]  = scanner.nextInt();
		} {
			s[i]  = scanner.nextInt();
		} s[i]  = scanner.nextInt() s[i] s i scanner.nextInt() scanner.nextInt scanner int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int c = 0; c 0 for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++; int i = 0; int i = 0; i 0 i < q i q i ++ i ++ i if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++; if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++; Arrays.binarySearch(s, scanner.nextInt()) >= 0 Arrays.binarySearch(s, scanner.nextInt()) Arrays.binarySearch Arrays s scanner.nextInt() scanner.nextInt scanner 0 c ++ c scanner.close() scanner.close scanner System.out.println(c) System.out.println System.out System System.out c String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int[] s = new int[n];
		
		for (int i = 0; i < n; i ++) {
			s[i]  = scanner.nextInt();
		}
		
		int q = scanner.nextInt();
		int c = 0;

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int n = scanner.nextInt();
		int[] s = new int[n];
		
		for (int i = 0; i < n; i ++) {
			s[i]  = scanner.nextInt();
		}
		
		int q = scanner.nextInt();
		int c = 0;

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	}
} Main
import java.util.*;
import java.io.*;

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

		for (int i = 0; i < q; i ++) if (Arrays.binarySearch(s, scanner.nextInt()) >= 0) c ++;
		
		scanner.close();
		
		System.out.println(c);
	}
} 

