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

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	static boolean binarySearch(int val, List<Integer> S) {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	}
}
 import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	static boolean binarySearch(int val, List<Integer> S) {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} main {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) List<Integer> T = new ArrayList<Integer>(); T new ArrayList<Integer>() List<Integer> S = new ArrayList<Integer>(); S new ArrayList<Integer>() int n = in.nextInt(); n in.nextInt() in.nextInt in for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int val = in.nextInt();
			S.add(val);
		} {
			int val = in.nextInt();
			S.add(val);
		} int val = in.nextInt(); val in.nextInt() in.nextInt in S.add(val) S.add S val int q = in.nextInt(); q in.nextInt() in.nextInt in for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int val = in.nextInt();
			T.add(val);
		} {
			int val = in.nextInt();
			T.add(val);
		} int val = in.nextInt(); val in.nextInt() in.nextInt in T.add(val) T.add T val int cnt = 0; cnt 0 for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		} int i = 0; int i = 0; i 0 i < T.size() i T.size() T.size T i++ i++ i {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		} {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		} if (binarySearch(T.get(i), S)) {
				cnt++;
			} binarySearch(T.get(i), S) binarySearch T.get(i) T.get T i S {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args static boolean binarySearch(int val, List<Integer> S) {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	} binarySearch {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	} int left left right; right left = 0 left 0 right = S.size() right S.size() S.size S while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		} left < right left right {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		} int mid = (right + left)/2; mid (right + left)/2 (right + left) right left 2 if (S.get(mid) == val) {
				return true;
			} S.get(mid) == val S.get(mid) S.get S mid val {
				return true;
			} return true; true if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			} val < S.get(mid) val S.get(mid) S.get S mid {
				right = mid;
			} right = mid right mid {
				left = mid+1;
			} left = mid+1 left mid+1 mid 1 return false; false int val val List<Integer> S S public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	static boolean binarySearch(int val, List<Integer> S) {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	static boolean binarySearch(int val, List<Integer> S) {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	}
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		List<Integer> T = new ArrayList<Integer>();
		List<Integer> S = new ArrayList<Integer>();
		
		int n = in.nextInt();
		for (int i = 0; i < n; i++) {
			int val = in.nextInt();
			S.add(val);
		}
		int q = in.nextInt();
		for (int i = 0; i < q; i++) {
			int val = in.nextInt();
			T.add(val);
		}
		
		int cnt = 0;
		for (int i = 0; i < T.size(); i++) {
			if (binarySearch(T.get(i), S)) {
				cnt++;
			}
		}
		System.out.println(cnt);
	}
	
	static boolean binarySearch(int val, List<Integer> S) {
		int left, right;
		
		left = 0;
		right = S.size();
		while (left < right) {
			int mid = (right + left)/2;
			if (S.get(mid) == val) {
				return true;
			}
			if (val < S.get(mid)) {
				right = mid;
			} else {
				left = mid+1;
			}
		}
		return false;
	}
}

