import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	}
} Main public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	} main {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	} int C = 0; C 0 Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int[] S = new int[n]; S new int[n] n for(int i = 0;i<n;i++) S[i] = in.nextInt(); int i = 0; int i = 0; i 0 i<n i n i++ i++ i S[i] = in.nextInt(); S[i] = in.nextInt() S[i] S i in.nextInt() in.nextInt in int q = in.nextInt(); q in.nextInt() in.nextInt in int[] T = new int[q]; T new int[q] q for(int i = 0;i<q;i++) T[i] = in.nextInt(); int i = 0; int i = 0; i 0 i<q i q i++ i++ i T[i] = in.nextInt(); T[i] = in.nextInt() T[i] T i in.nextInt() in.nextInt in for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		} int i = 0; int i = 0; i 0 i<q i q i++ i++ i {
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		} {
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		} int searchkey = T[i]; searchkey T[i] T i int lowerBound = 0; lowerBound 0 int upperBound = n-1; upperBound n-1 n 1 int curIn; curIn while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			} true {
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			} curIn = (lowerBound+upperBound)/2 curIn (lowerBound+upperBound)/2 (lowerBound+upperBound) lowerBound upperBound 2 if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				} S[curIn] == searchkey S[curIn] S curIn searchkey {
					C++;
					break;
				} C++ C break; if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				} lowerBound>upperBound lowerBound upperBound break; {
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				} if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1; S[curIn]<searchkey S[curIn] S curIn searchkey lowerBound = curIn +1 lowerBound curIn +1 curIn 1 upperBound = curIn -1 upperBound curIn -1 curIn 1 System.out.println(C) System.out.println System.out System System.out C String[] args args public class Main{
	public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	}
} public class Main{
	public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		int C = 0;
		Scanner in = new Scanner(System.in);
		//??°???S?????????
		int n = in.nextInt();
		int[] S = new int[n];
		for(int i = 0;i<n;i++) S[i] = in.nextInt();
		//??°???T?????????
		int q = in.nextInt();
		int[] T = new int[q];
		for(int i = 0;i<q;i++) T[i] = in.nextInt();
		
	
		for(int i = 0;i<q;i++){
			int searchkey = T[i];
			int lowerBound = 0;
			int upperBound = n-1;
			int curIn;
			while(true){
				curIn = (lowerBound+upperBound)/2;
				if(S[curIn] == searchkey) {
					C++;
					break;
				}else if(lowerBound>upperBound) break;
				else{
					if(S[curIn]<searchkey)
						lowerBound = curIn +1;
					else
						upperBound = curIn -1;
				}
				
			}
		}
		System.out.println(C);
	}
}