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

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	}

	public static int search(int[] s,int[] t){
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	}

	public static boolean binarySearch(int[] s,int key){
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] strAryToIntAry(String[] strAry){
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	}

	public static int search(int[] s,int[] t){
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	}

	public static boolean binarySearch(int[] s,int key){
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] strAryToIntAry(String[] strAry){
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	}

} Main public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	} main {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	} BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); r new BufferedReader(new InputStreamReader(System.in)) int n = readInt(r); n readInt(r) readInt r int[] s = strAryToIntAry(r.readLine().split(" ")); s strAryToIntAry(r.readLine().split(" ")) strAryToIntAry r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " int q = readInt(r); q readInt(r) readInt r int[] t = strAryToIntAry(r.readLine().split(" ")); t strAryToIntAry(r.readLine().split(" ")) strAryToIntAry r.readLine().split(" ") r.readLine().split r.readLine() r.readLine r " " System.out.println(search(s, t)) System.out.println System.out System System.out search(s, t) search s t String[] args args public static int search(int[] s,int[] t){
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	} search {
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	} int sum = 0; sum 0 for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		} int i = 0 ; int i = 0 ; i 0 i < t.length i t.length t t.length i++ i++ i {
			if(binarySearch(s,t[i])) sum++;
		} {
			if(binarySearch(s,t[i])) sum++;
		} if(binarySearch(s,t[i])) sum++; binarySearch(s,t[i]) binarySearch s t[i] t i sum++ sum return sum; sum int[] s s int[] t t public static boolean binarySearch(int[] s,int key){
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	} binarySearch {
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	} int left = 0; left 0 int right = s.length - 1; right s.length - 1 s.length s s.length 1 int mid; mid while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		} left <= right left right {
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		} mid = (left+right)/2 mid (left+right)/2 (left+right) left right 2 if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			} key == s[mid] key s[mid] s mid {
				return true;
			} return true; true if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			} key < s[mid] key s[mid] s mid {
				right = mid - 1;
			} right = mid - 1 right mid - 1 mid 1 {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 return false; false int[] s s int key key public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    } readInt {
        return Integer.parseInt(r.readLine());
    } return Integer.parseInt(r.readLine()); Integer.parseInt(r.readLine()) Integer.parseInt Integer r.readLine() r.readLine r BufferedReader r r public static int[] strAryToIntAry(String[] strAry){
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	} strAryToIntAry {
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	} int arraySize = strAry.length; arraySize strAry.length strAry strAry.length int[] intAry= new int[arraySize]; intAry new int[arraySize] arraySize for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		} int i = 0 ; int i = 0 ; i 0 i < arraySize i arraySize i++ i++ i {
			intAry[i] =Integer.parseInt(strAry[i]);
		} {
			intAry[i] =Integer.parseInt(strAry[i]);
		} intAry[i] =Integer.parseInt(strAry[i]) intAry[i] intAry i Integer.parseInt(strAry[i]) Integer.parseInt Integer strAry[i] strAry i return intAry; intAry String[] strAry strAry public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	}

	public static int search(int[] s,int[] t){
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	}

	public static boolean binarySearch(int[] s,int key){
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] strAryToIntAry(String[] strAry){
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	}

} public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	}

	public static int search(int[] s,int[] t){
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	}

	public static boolean binarySearch(int[] s,int key){
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] strAryToIntAry(String[] strAry){
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
		 int n = readInt(r);
		 int[] s = strAryToIntAry(r.readLine().split(" "));
		 int q = readInt(r);
		 int[] t = strAryToIntAry(r.readLine().split(" "));

		 System.out.println(search(s, t));
	}

	public static int search(int[] s,int[] t){
		int sum = 0;
		for(int i = 0 ; i < t.length ; i++ ){
			if(binarySearch(s,t[i])) sum++;
		}
		return sum;
	}

	public static boolean binarySearch(int[] s,int key){
		int left = 0;
		int right = s.length - 1;
		int mid;
		while(left <= right){
			mid = (left+right)/2;
			if(key == s[mid]){
				return true;
			}else if(key < s[mid]){
				right = mid - 1;
			}else{
				left = mid + 1;
			}
		}
		return false;
	}

	public static int readInt(BufferedReader r) throws Exception{
        return Integer.parseInt(r.readLine());
    }

	public static int[] strAryToIntAry(String[] strAry){
		int arraySize = strAry.length;
		int[] intAry= new int[arraySize];
		for(int i = 0 ; i < arraySize ; i++){
			intAry[i] =Integer.parseInt(strAry[i]);
		}

		return intAry;
	}

}