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


public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(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 NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(count);
	}

 } Main public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(count);
	} main {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(count);
	} BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(bf.readLine()); n Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf String[] sString = bf.readLine().split(" "); sString bf.readLine().split(" ") bf.readLine().split bf.readLine() bf.readLine bf " " int q = Integer.parseInt(bf.readLine()); q Integer.parseInt(bf.readLine()) Integer.parseInt Integer bf.readLine() bf.readLine bf String[] tString = bf.readLine().split(" "); tString bf.readLine().split(" ") bf.readLine().split bf.readLine() bf.readLine bf " " int count=0; count 0 for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		} {
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		} int search = Integer.parseInt(tString[i]); search Integer.parseInt(tString[i]) Integer.parseInt Integer tString[i] tString i int left=0; left 0 int right = n; right n while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		} left<right left right {
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		} int mid = (left+right)/2; mid (left+right)/2 (left+right) left right 2 if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			} Integer.parseInt(sString[mid])==search Integer.parseInt(sString[mid]) Integer.parseInt Integer sString[mid] sString mid search {
				count++;
				break;
			} count++ count break; if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			} Integer.parseInt(sString[mid])>search Integer.parseInt(sString[mid]) Integer.parseInt Integer sString[mid] sString mid search {
				right=mid;
			} right=mid right mid if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			} Integer.parseInt(sString[mid])<search Integer.parseInt(sString[mid]) Integer.parseInt Integer sString[mid] sString mid search {
				left= mid+1;
			} left= mid+1 left mid+1 mid 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(count);
	}

 } public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(count);
	}

 } 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 {
		//????????????????????????
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		
		//?????????
		int n = Integer.parseInt(bf.readLine());
		String[] sString = bf.readLine().split(" ");
		int q = Integer.parseInt(bf.readLine());
		String[] tString = bf.readLine().split(" ");
	
		int count=0;
		

		
		for(int i=0;i<q;i++){
			int search = Integer.parseInt(tString[i]);
			int left=0;
			int right = n;
		while(left<right){
			int mid = (left+right)/2;
			if(Integer.parseInt(sString[mid])==search){
				count++;
				break;
			}else if(Integer.parseInt(sString[mid])>search){
				right=mid;
			}else if(Integer.parseInt(sString[mid])<search){
				left= mid+1;
			}
		}
		}
		System.out.println(count);
	}

 }