import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] s = new int[n]; s new int[n] n for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			s[i] = sc.nextInt();
		} {
			s[i] = sc.nextInt();
		} s[i] = sc.nextInt() s[i] s i sc.nextInt() sc.nextInt sc int p = sc.nextInt(); p sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		} int i=0; int i=0; i 0 i<p i p i++ i++ i {
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		} {
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		} int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int upp = n - 1; upp n - 1 n 1 int low = 0; low 0 int mid = (upp + low) / 2; mid (upp + low) / 2 (upp + low) upp low 2 while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			} low<=upp low upp {
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			} if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				} s[mid]==q s[mid] s mid q {
					ans++;
					break;
				} ans++ ans break; if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				} s[mid]<q s[mid] s mid q {
					low = mid + 1;
					mid = (low + upp) / 2;
				} low = mid + 1 low mid + 1 mid 1 mid = (low + upp) / 2 mid (low + upp) / 2 (low + upp) low upp 2 {
					upp = mid - 1;
					mid = (low + upp) / 2;
				} upp = mid - 1 upp mid - 1 mid 1 mid = (low + upp) / 2 mid (low + upp) / 2 (low + upp) low upp 2 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	}
} public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] s = new int[n];
		for(int i=0; i<n; i++){
			s[i] = sc.nextInt();
		}
		int p = sc.nextInt();
		int ans = 0;
		for(int i=0; i<p; i++){
			int q = sc.nextInt();
			int upp = n - 1;
			int low = 0;
			int mid = (upp + low) / 2;
			while(low<=upp){
				if(s[mid]==q){
					ans++;
					break;
				}
				else if(s[mid]<q){
					low = mid + 1;
					mid = (low + upp) / 2;
				}
				else{
					upp = mid - 1;
					mid = (low + upp) / 2;
				}
			}
		}
		System.out.println(ans);
	}
}
