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

public class Main {

	public static void main(String[] args) throws Exception, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	}

	public static int binarySearch(int[] S,int[] T){
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	}

} 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 Exception, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	}

	public static int binarySearch(int[] S,int[] T){
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	}

} Main public static void main(String[] args) throws Exception, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	} 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 String[] sStr = br.readLine().split(" "); sStr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int S[] = new int[n]; S new int[n] n for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		} int i = 0 ; int i = 0 ; i 0 i < n i n i++ i++ i {
			S[i] = Integer.parseInt(sStr[i]);
		} {
			S[i] = Integer.parseInt(sStr[i]);
		} S[i] = Integer.parseInt(sStr[i]) S[i] S i Integer.parseInt(sStr[i]) Integer.parseInt Integer sStr[i] sStr i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] tStr = br.readLine().split(" "); tStr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int T[] = new int[q]; T new int[q] q for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		} int i = 0 ; int i = 0 ; i 0 i < q i q i++ i++ i {
			T[i] = Integer.parseInt(tStr[i]);
		} {
			T[i] = Integer.parseInt(tStr[i]);
		} T[i] = Integer.parseInt(tStr[i]) T[i] T i Integer.parseInt(tStr[i]) Integer.parseInt Integer tStr[i] tStr i System.out.println(binarySearch(S,T)) System.out.println System.out System System.out binarySearch(S,T) binarySearch S T String[] args args public static int binarySearch(int[] S,int[] T){
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	} binarySearch {
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	} int min; min int max; max int mid; mid int count = 0; count 0 int searchNum; searchNum for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		} int y = 0; int y = 0; y 0 y < T.length y T.length T T.length y++ y++ y {
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		} {
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		} searchNum = T[y] searchNum T[y] T y min = 0 min 0 max = S.length max S.length S S.length while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			} max > min max min {
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			} mid = (max + min) / 2 mid (max + min) / 2 (max + min) max min 2 if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				} S[mid] == searchNum S[mid] S mid searchNum {
					count++;
					break;
				} count++ count break; if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				} S[mid] < searchNum S[mid] S mid searchNum {
					min = mid + 1;
				} min = mid + 1 min mid + 1 mid 1 {
					max = mid;
				} max = mid max mid return count; count int[] S S int[] T T public class Main {

	public static void main(String[] args) throws Exception, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	}

	public static int binarySearch(int[] S,int[] T){
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	}

} public class Main {

	public static void main(String[] args) throws Exception, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	}

	public static int binarySearch(int[] S,int[] T){
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	}

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

public class Main {

	public static void main(String[] args) throws Exception, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n =  Integer.parseInt(br.readLine());
		String[] sStr = br.readLine().split(" ");
		int S[] = new int[n];
		for(int i = 0 ; i < n ; i++){
			S[i] = Integer.parseInt(sStr[i]);
		}

		int q = Integer.parseInt(br.readLine());
		String[] tStr = br.readLine().split(" ");
		int T[] = new int[q];
		for(int i = 0 ; i < q ; i++){
			T[i] = Integer.parseInt(tStr[i]);
		}

		System.out.println(binarySearch(S,T));
	}

	public static int binarySearch(int[] S,int[] T){
		int min;
		int max;
		int mid;
		int count = 0;
		int searchNum;

		for(int y = 0; y < T.length; y++){
			searchNum = T[y];
			min = 0;
			max = S.length;
			while(max > min){
				mid = (max + min) / 2;
				if(S[mid] == searchNum){
					count++;
					break;
				}else if(S[mid] < searchNum){
					min = mid + 1;
				}else{
					max = mid;
				}
			}
		}

		return count;
	}

}