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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	}
} 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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	}
} 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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	} 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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	} 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 q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = sc.nextInt();
		} {
			T[i] = sc.nextInt();
		} T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int low low mid mid high high key key cnt = 0; cnt 0 for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		} {
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		} low = 0 low 0 high = n - 1 high n - 1 n 1 key = T[i] key T[i] T i while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			} low <= high low high {
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			} mid = (low + high) / 2 mid (low + high) / 2 (low + high) low high 2 if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				} S[mid] == key S[mid] S mid key {
					cnt++;
					break;
				} cnt++ cnt break; if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				} S[mid] < key S[mid] S mid key {
					low = mid + 1;
				} low = mid + 1 low mid + 1 mid 1 if(S[mid] > key) {
					high = mid - 1;
				} S[mid] > key S[mid] S mid key {
					high = mid - 1;
				} high = mid - 1 high mid - 1 mid 1 System.out.println(cnt) System.out.println System.out System System.out cnt 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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	}
} 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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	}
} 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 q = sc.nextInt();
		int[] T = new int[q];

		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}

		int low,mid,high,key,cnt = 0;

		for(int i = 0;i < q;i++){
			low = 0;
			high = n - 1;
			key = T[i];
			while(low <= high){
				mid = (low + high) / 2;
				if(S[mid] == key){
					cnt++;
					break;
				} else if(S[mid] < key){
					low = mid + 1;
				} else if(S[mid] > key) {
					high = mid - 1;
				}
			}
		}
		System.out.println(cnt);
	}
}