import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static List<Integer> s;
	static int count;

	public static void binarySearch(int value) {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	static List<Integer> s;
	static int count;

	public static void binarySearch(int value) {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	}
} Main static List<Integer> s; s static int count; count public static void binarySearch(int value) {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	} binarySearch {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	} int left = 0 left 0 right = s.size(); right s.size() s.size s while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		} left < right left right {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			} s.get(mid).intValue() == value s.get(mid).intValue() s.get(mid).intValue s.get(mid) s.get s mid value {
				count++;
				break;
			} count++ count break; if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			} value < s.get(mid) value s.get(mid) s.get s mid {
				right = mid;
			} right = mid right mid {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 int value value public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc s = new ArrayList<>() s new ArrayList<>() 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(sc.nextInt()) s.add s sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc count = 0 count 0 for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			binarySearch(sc.nextInt());
		} {
			binarySearch(sc.nextInt());
		} binarySearch(sc.nextInt()) binarySearch sc.nextInt() sc.nextInt sc System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	static List<Integer> s;
	static int count;

	public static void binarySearch(int value) {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	}
} public class Main {
	static List<Integer> s;
	static int count;

	public static void binarySearch(int value) {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	static List<Integer> s;
	static int count;

	public static void binarySearch(int value) {
		int left = 0, right = s.size();
		while (left < right) {
			int mid = (left + right) / 2;
			if (s.get(mid).intValue() == value) {
				count++;
				break;
			} else if(value < s.get(mid)){
				right = mid;
			} else {
				left = mid + 1;
			}
			mid = (left + right) / 2;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			s.add(sc.nextInt());
		}
		int q = sc.nextInt();
		count = 0;
		for (int i = 0; i < q; i++) {
			binarySearch(sc.nextInt());
		}
		System.out.println(count);
	}
}
