import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	}
	
	public static int binarySearch(int[] arr, int target) {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	}
	
	public static int binarySearch(int[] arr, int target) {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	}
} Main public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	} main {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(reader.readLine()); n Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader String[] strArray = reader.readLine().split(" "); strArray reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = Integer.parseInt(strArray[i]);
		} {
			arr[i] = Integer.parseInt(strArray[i]);
		} arr[i] = Integer.parseInt(strArray[i]) arr[i] arr i Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i int q = Integer.parseInt(reader.readLine()); q Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader strArray = reader.readLine().split(" ") strArray reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int ans = 0; ans 0 for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		} {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		} ans += binarySearch(arr, Integer.parseInt(strArray[i])) ans binarySearch(arr, Integer.parseInt(strArray[i])) binarySearch arr Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int binarySearch(int[] arr, int target) {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	} binarySearch {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	} if (arr == null || arr.length == 0) {
			return 0;
		} arr == null || arr.length == 0 arr == null arr null arr.length == 0 arr.length arr arr.length 0 {
			return 0;
		} return 0; 0 int n = arr.length; n arr.length arr arr.length int floor = 0; floor 0 int ceiling = n - 1; ceiling n - 1 n 1 while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		} floor <= ceiling floor ceiling {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		} int guessIdx = floor + (ceiling - floor) / 2; guessIdx floor + (ceiling - floor) / 2 floor (ceiling - floor) / 2 (ceiling - floor) ceiling floor 2 int guessValue = arr[guessIdx]; guessValue arr[guessIdx] arr guessIdx if (guessValue == target) {
				return 1;
			} guessValue == target guessValue target {
				return 1;
			} return 1; 1 if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			} guessValue < target guessValue target {
				floor = guessIdx + 1;
			} floor = guessIdx + 1 floor guessIdx + 1 guessIdx 1 {
				ceiling = guessIdx - 1;
			} ceiling = guessIdx - 1 ceiling guessIdx - 1 guessIdx 1 return 0; 0 int[] arr arr int target target public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	}
	
	public static int binarySearch(int[] arr, int target) {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	}
	
	public static int binarySearch(int[] arr, int target) {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(reader.readLine());
		strArray = reader.readLine().split(" ");
		int ans = 0;
		for (int i = 0; i < q; i++) {
			ans += binarySearch(arr, Integer.parseInt(strArray[i]));
		}
		System.out.println(ans);		
	}
	
	public static int binarySearch(int[] arr, int target) {
		
		if (arr == null || arr.length == 0) {
			return 0;
		}
		int n = arr.length;
		
		int floor = 0;
		int ceiling = n - 1;
		
		while (floor <= ceiling) {
			int guessIdx = floor + (ceiling - floor) / 2;
			int guessValue = arr[guessIdx];
			if (guessValue == target) {
				return 1;
			}
			if (guessValue < target) {
				floor = guessIdx + 1;
			} else {
				ceiling = guessIdx - 1;
			}
		}
		return 0;
	}
}
