
import java.util.Scanner;

public class Main {
	
	static int search(int[] a, int key) {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	}

}
 import java.util.Scanner; Scanner java.util public class Main {
	
	static int search(int[] a, int key) {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	}

} Main static int search(int[] a, int key) {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	} search {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	} int left=0 left 0 right=a.length; right a.length a a.length int mid; mid while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		} left < right left right {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		} mid = (left+right) / 2 mid (left+right) / 2 (left+right) left right 2 if (key == a[mid]) return mid; key == a[mid] key a[mid] a mid return mid; mid if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid; key > a[mid] key a[mid] a mid left = mid+1 left mid+1 mid 1 if (key < a[mid]) right = mid; key < a[mid] key a[mid] a mid right = mid right mid return -1; -1 1 int[] a a int key key public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			a[i] = sc.nextInt();
		} {
			a[i] = sc.nextInt();
		} a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc int sum = 0; sum 0 int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		} {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		} int key = sc.nextInt(); key sc.nextInt() sc.nextInt sc if (search(a, key) >= 0)
				sum ++; search(a, key) >= 0 search(a, key) search a key 0 sum ++ sum sc.close() sc.close sc System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
	
	static int search(int[] a, int key) {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	}

} public class Main {
	
	static int search(int[] a, int key) {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	}

} Main

import java.util.Scanner;

public class Main {
	
	static int search(int[] a, int key) {
		int left=0, right=a.length;
		int mid;
		while (left < right) {
			mid = (left+right) / 2;
			if (key == a[mid]) return mid;
			if (key > a[mid]) left = mid+1;
			else if (key < a[mid]) right = mid;
		}
		return -1;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) {
			a[i] = sc.nextInt();
		}
		
		int sum = 0;
		
		int q = sc.nextInt();
		for (int i=0; i<q; i++) {
			int key = sc.nextInt();
			if (search(a, key) >= 0)
				sum ++;
		}
		
		sc.close();
		
		System.out.println(sum);
	}

}

