import java.util.Scanner;

class Main{
    public static void main(String[] args){

	int n, q;
	int c = 0;

	Scanner sc = new Scanner(System.in);
      
        n = sc.nextInt();

	int[] s = new int[n];

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

	q = sc.nextInt();

	for(int i = 0; i < q; i++){
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	}

	System.out.println(c);
    }
}
 import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){

	int n, q;
	int c = 0;

	Scanner sc = new Scanner(System.in);
      
        n = sc.nextInt();

	int[] s = new int[n];

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

	q = sc.nextInt();

	for(int i = 0; i < q; i++){
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	}

	System.out.println(c);
    }
} Main public static void main(String[] args){

	int n, q;
	int c = 0;

	Scanner sc = new Scanner(System.in);
      
        n = sc.nextInt();

	int[] s = new int[n];

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

	q = sc.nextInt();

	for(int i = 0; i < q; i++){
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	}

	System.out.println(c);
    } main {

	int n, q;
	int c = 0;

	Scanner sc = new Scanner(System.in);
      
        n = sc.nextInt();

	int[] s = new int[n];

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

	q = sc.nextInt();

	for(int i = 0; i < q; i++){
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	}

	System.out.println(c);
    } int n n q; q int c = 0; c 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) 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 q = sc.nextInt() q sc.nextInt() sc.nextInt sc for(int i = 0; i < q; i++){
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	} {
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	} int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc int pos = -1; pos -1 1 int lower = 0; lower 0 int upper = n - 1; upper n - 1 n 1 while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    } lower <= upper lower upper {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    } int mid = (lower + upper) / 2; mid (lower + upper) / 2 (lower + upper) lower upper 2 if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		} s[mid] == t s[mid] s mid t {
		    pos = mid;
		    c++;
		    break;
		} pos = mid pos mid c++ c break; if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		} s[mid] < t s[mid] s mid t {
		    lower = mid + 1;
		} lower = mid + 1 lower mid + 1 mid 1 {
		    upper = mid - 1;
		} upper = mid - 1 upper 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){

	int n, q;
	int c = 0;

	Scanner sc = new Scanner(System.in);
      
        n = sc.nextInt();

	int[] s = new int[n];

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

	q = sc.nextInt();

	for(int i = 0; i < q; i++){
	    int t = sc.nextInt(); 	
	    int pos = -1;
	    int lower = 0; 
	    int upper = n - 1;
	    while (lower <= upper) {
		int mid = (lower + upper) / 2;
		if (s[mid] == t) {
		    pos = mid;
		    c++;
		    break;
		} else if (s[mid] < t) {
		    lower = mid + 1;
		} else {
		    upper = mid - 1;
		}
	    }
	}

	System.out.println(c);
    }
}

