import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	}





	private static boolean binarySearch(int[] s, int key, int n) {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	}





	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	}





	private static boolean binarySearch(int[] s, int key, int n) {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	}





	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	} main {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) sc.useDelimiter(System.getProperty("line.separator")) sc.useDelimiter sc System.getProperty("line.separator") System.getProperty System "line.separator" int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String SStr = sc.next(); SStr sc.next() sc.next sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc String TStr = sc.next(); TStr sc.next() sc.next sc int[] S = toIntAry(SStr, n); S toIntAry(SStr, n) toIntAry SStr n int[] T = toIntAry(TStr, q); T toIntAry(TStr, q) toIntAry TStr q int cnt=0; cnt 0 for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        } int i=0; int i=0; i 0 i<q i q i++ i++ i {
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        } {
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        } int key = T[i]; key T[i] T i if(binarySearch(S,key,n))cnt++; binarySearch(S,key,n) binarySearch S key n cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args private static boolean binarySearch(int[] s, int key, int n) {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	} binarySearch {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	} int left = 0; left 0 int right = n; right n while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		} left<right left right {
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		} int mid = (left+right)/2; mid (left+right)/2 (left+right) left right 2 if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			} s[mid]==key s[mid] s mid key {
				return true;
			} return true; true if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			} s[mid] > key s[mid] s mid key {
				right = mid;
			} right = mid right mid {
				left = mid +1;
			} left = mid +1 left mid +1 mid 1 return false; false int[] s s int key key int n n private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	} toIntAry {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	} String[] tmp = str.split(" "); tmp str.split(" ") str.split str " " int[] A = new int[n]; A new int[n] n for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			A[i] = Integer.parseInt(tmp[i]);
		} {
			A[i] = Integer.parseInt(tmp[i]);
		} A[i] = Integer.parseInt(tmp[i]) A[i] A i Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i return A; A String str str int n n public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	}





	private static boolean binarySearch(int[] s, int key, int n) {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	}





	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	}





	private static boolean binarySearch(int[] s, int key, int n) {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	}





	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        int n = sc.nextInt();
        String SStr = sc.next();
        int q = sc.nextInt();
        String TStr = sc.next();

        int[] S = toIntAry(SStr, n);
        int[] T = toIntAry(TStr, q);

        int cnt=0;
        for(int i=0; i<q; i++){
        	int key = T[i];
        	if(binarySearch(S,key,n))cnt++;
        }

        System.out.println(cnt);

	}





	private static boolean binarySearch(int[] s, int key, int n) {
		int left = 0;
		int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(s[mid]==key){
				return true;
			}else if(s[mid] > key){
				right = mid;
			}else{
				left = mid +1;
			}
		}

		return false;
	}





	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


}