import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n];
		int i;
		for(i=0; i<n; i++){
			S[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int T[] = new int[n];
		int j;
		for(j=0; j<q; j++){
			T[j] = sc.nextInt();
		}
		int C=0;
		int left, right, mid;
		for(j=0; j<q; j++){
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		}
		System.out.println(C);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n];
		int i;
		for(i=0; i<n; i++){
			S[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int T[] = new int[n];
		int j;
		for(j=0; j<q; j++){
			T[j] = sc.nextInt();
		}
		int C=0;
		int left, right, mid;
		for(j=0; j<q; j++){
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		}
		System.out.println(C);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n];
		int i;
		for(i=0; i<n; i++){
			S[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int T[] = new int[n];
		int j;
		for(j=0; j<q; j++){
			T[j] = sc.nextInt();
		}
		int C=0;
		int left, right, mid;
		for(j=0; j<q; j++){
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		}
		System.out.println(C);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n];
		int i;
		for(i=0; i<n; i++){
			S[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int T[] = new int[n];
		int j;
		for(j=0; j<q; j++){
			T[j] = sc.nextInt();
		}
		int C=0;
		int left, right, mid;
		for(j=0; j<q; j++){
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		}
		System.out.println(C);
	} 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 int i; i for(i=0; i<n; i++){
			S[i] = sc.nextInt();
		} i=0; 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[n]; T new int[n] n int j; j for(j=0; j<q; j++){
			T[j] = sc.nextInt();
		} j=0; j=0 j 0 j<q j q j++ j++ j {
			T[j] = sc.nextInt();
		} {
			T[j] = sc.nextInt();
		} T[j] = sc.nextInt() T[j] T j sc.nextInt() sc.nextInt sc int C=0; C 0 int left left right right mid; mid for(j=0; j<q; j++){
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		} j=0; j=0 j 0 j<q j q j++ j++ j {
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		} {
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		} left = 0 left 0 right = n right n while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			} left < right left right {
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				} T[j] == S[mid] T[j] T j S[mid] S mid {
					C++;
					break;
				} C++ C break; if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				} T[j] < S[mid] T[j] T j S[mid] S mid {
					right = mid;
				} right = mid right mid {
					left = mid + 1;
				} left = mid + 1 left mid + 1 mid 1 System.out.println(C) System.out.println System.out System System.out C String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int S[] = new int[n];
		int i;
		for(i=0; i<n; i++){
			S[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int T[] = new int[n];
		int j;
		for(j=0; j<q; j++){
			T[j] = sc.nextInt();
		}
		int C=0;
		int left, right, mid;
		for(j=0; j<q; j++){
			left = 0;
			right = n;
			while(left < right){
				mid = (left + right) / 2;
				if(T[j] == S[mid]){
					C++;
					break;
				} else if(T[j] < S[mid]){
					right = mid;
				} else{
					left = mid + 1;
				}
			}
		}
		System.out.println(C);
	}
}