import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	}
	public static boolean search(int[] nums,int x){
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	}
} import java.util.*; util.* java public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	}
	public static boolean search(int[] nums,int x){
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	}
} Main public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	} main {
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	} Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int n n q; q n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] nums = new int[n]; nums new int[n] n for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			nums[i] = sc.nextInt();
		} {
			nums[i] = sc.nextInt();
		} nums[i] = sc.nextInt() nums[i] nums i sc.nextInt() sc.nextInt sc q = sc.nextInt() q sc.nextInt() sc.nextInt sc int[] data = new int[q]; data new int[q] q for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			data[i] = sc.nextInt();
		} {
			data[i] = sc.nextInt();
		} data[i] = sc.nextInt() data[i] data i sc.nextInt() sc.nextInt sc Arrays.sort(nums) Arrays.sort Arrays nums int ans =0; ans 0 for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			if(search(nums,data[i])){
				ans++;
			}
		} {
			if(search(nums,data[i])){
				ans++;
			}
		} if(search(nums,data[i])){
				ans++;
			} search(nums,data[i]) search nums data[i] data i {
				ans++;
			} ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String args[] args public static boolean search(int[] nums,int x){
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	} search {
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	} int l =0; l 0 int r = nums.length-1; r nums.length-1 nums.length nums nums.length 1 while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		} l<=r l r {
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		} int mid = l+(r-l)/2; mid l+(r-l)/2 l (r-l)/2 (r-l) r l 2 if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			} nums[mid]==x nums[mid] nums mid x {
				return true;
			} return true; true if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			} nums[mid]>x nums[mid] nums mid x {
				r =mid-1;
			} r =mid-1 r mid-1 mid 1 {
				l =mid+1;
			} l =mid+1 l mid+1 mid 1 return false; false int[] nums nums int x x public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	}
	public static boolean search(int[] nums,int x){
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	}
} public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	}
	public static boolean search(int[] nums,int x){
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	}
} Main
import java.util.*;
public class Main {
	public static void main(String args[]){
		Scanner sc =new Scanner(System.in);
		int n,q;
		n = sc.nextInt();
		int[] nums = new int[n];
		for(int i=0;i<n;i++){
			nums[i] = sc.nextInt();
		}
		q = sc.nextInt();
		int[] data = new int[q];
		for(int i=0;i<q;i++){
			data[i] = sc.nextInt();
		}
		Arrays.sort(nums);
		int ans =0;
		for(int i=0;i<q;i++){
			if(search(nums,data[i])){
				ans++;
			}
		}
		System.out.println(ans);
		
		
	}
	public static boolean search(int[] nums,int x){
		int l =0; 
		int r = nums.length-1;
		while(l<=r){
			int mid = l+(r-l)/2;
			if(nums[mid]==x){
				return true;
			}else if(nums[mid]>x){
				r =mid-1;
			}else{
				l =mid+1;
			}
		}
		return false;
	}
}