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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	}
	
	static int linearSearch (int[] array , int key){
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	}
	
	static int binarySearch(int[] array, int key){
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	}

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

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	}
	
	static int linearSearch (int[] array , int key){
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	}
	
	static int binarySearch(int[] array, int key){
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	} main {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] S = new int[n]; S new int[n] n String[] strArray = br.readLine().split(" "); strArray br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = Integer.parseInt(strArray[i]);
		} {
			S[i] = Integer.parseInt(strArray[i]);
		} S[i] = Integer.parseInt(strArray[i]) S[i] S i Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] T = new int[q]; T new int[q] q strArray = br.readLine().split(" ") strArray br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = Integer.parseInt(strArray[i]);
		} {
			T[i] = Integer.parseInt(strArray[i]);
		} T[i] = Integer.parseInt(strArray[i]) T[i] T i Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i int count = 0; count 0 for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		} {
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		} if(binarySearch(S, T[i]) != -1){
				count++;
			} binarySearch(S, T[i]) != -1 binarySearch(S, T[i]) binarySearch S T[i] T i -1 1 {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args static int linearSearch (int[] array , int key){
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	} linearSearch {
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	} int result = -1; result -1 1 for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
			if(array[i] == key){
				return i;
			}
		} {
			if(array[i] == key){
				return i;
			}
		} if(array[i] == key){
				return i;
			} array[i] == key array[i] array i key {
				return i;
			} return i; i return result; result int[] array array int key key static int binarySearch(int[] array, int key){
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	} binarySearch {
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	} int left = 0; left 0 int right = array.length; right array.length array array.length int mid; mid while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		} left < right left right {
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			} array[mid] == key array[mid] array mid key {
				return mid;
			} return mid; mid if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			} key < array[mid] key array[mid] array mid {
				right = mid;
			} right = mid right mid {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 return -1; -1 1 int[] array array int key key public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	}
	
	static int linearSearch (int[] array , int key){
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	}
	
	static int binarySearch(int[] array, int key){
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	}

} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	}
	
	static int linearSearch (int[] array , int key){
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	}
	
	static int binarySearch(int[] array, int key){
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n];
		String[] strArray = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(strArray[i]);
		}
		
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		strArray = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(strArray[i]);
		}		
		
		int count = 0;
		for(int i = 0; i < T.length ; i++){
			//if(linearSearch(S, T[i]) != -1){
			if(binarySearch(S, T[i]) != -1){
				count++;
			}
		}
		System.out.println(count);
	}
	
	static int linearSearch (int[] array , int key){
		int result = -1;
		
		for(int i = 0; i < array.length ;i++){
			if(array[i] == key){
				return i;
			}
		}
		
		return result;
	}
	
	static int binarySearch(int[] array, int key){
		int left = 0;
		int right = array.length;
		int mid;
		
		while(left < right){
			mid = (left + right) / 2;
			if(array[mid] == key){
				return mid;
			}
			else if(key < array[mid]){
				right = mid;
			}
			else {
				left = mid + 1;
			}
		}
		
		return -1;
	}

}