import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	}
	
	public static int binarySearch(int t, int[] S, int len){
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	}
} import java.util.*; util.* java public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	}
	
	public static int binarySearch(int t, int[] S, int len){
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	} main {
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n q q cnt = 0 cnt 0 isExist; isExist int[] S = new int[100000] S new int[100000] 100000 T = new int[50000]; T new int[50000] 50000 n = sc.nextInt() n sc.nextInt() sc.nextInt sc 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 q = sc.nextInt() q sc.nextInt() sc.nextInt sc 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 for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		} {
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		} isExist = binarySearch(T[i], S, n) isExist binarySearch(T[i], S, n) binarySearch T[i] T i S n if(isExist == 1){
				cnt ++;
			} isExist == 1 isExist 1 {
				cnt ++;
			} cnt ++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String args[] args public static int binarySearch(int t, int[] S, int len){
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	} binarySearch {
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	} int first = 0 first 0 last = len - 1 last len - 1 len 1 middle; middle int isExist = 0; isExist 0 while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		} isExist == 0 && first <= last isExist == 0 isExist 0 first <= last first last {
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		} middle = (first + last) / 2 middle (first + last) / 2 (first + last) first last 2 if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			} S[middle] == t S[middle] S middle t {
				isExist = 1;
			} isExist = 1 isExist 1 if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			} t < S[middle] t S[middle] S middle {
				last = middle - 1;
			} last = middle - 1 last middle - 1 middle 1 if(S[middle] < t){
				first = middle + 1;
			} S[middle] < t S[middle] S middle t {
				first = middle + 1;
			} first = middle + 1 first middle + 1 middle 1 return isExist; isExist int t t int[] S S int len len public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	}
	
	public static int binarySearch(int t, int[] S, int len){
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	}
} public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	}
	
	public static int binarySearch(int t, int[] S, int len){
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	}
} Main
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int n, q, cnt = 0, isExist;
		int[] S = new int[100000], T = new int[50000];
		
		n = sc.nextInt();
		for(int i = 0; i < n; i++){
			S[i] = sc.nextInt();
		}
		
		q = sc.nextInt();
		for(int i = 0; i < q; i++){
			T[i] = sc.nextInt();
		}
		
		for(int i = 0; i < q; i++){
			isExist = binarySearch(T[i], S, n);
			if(isExist == 1){
				cnt ++;
			}
		}
		
		System.out.println(cnt);
	}
	
	public static int binarySearch(int t, int[] S, int len){
		int first = 0, last = len - 1, middle;
		int isExist = 0;
		
		while(isExist == 0 && first <= last){
			middle = (first + last) / 2;
			if(S[middle] == t){
				isExist = 1;
			}
			else if(t < S[middle]){
				last = middle - 1;
			}
			else if(S[middle] < t){
				first = middle + 1;
			}
		}
		
		return isExist;
	}
}