import java.util.Scanner;
public class Main {
private static Scanner s;

public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
}
}
 import java.util.Scanner; Scanner java.util public class Main {
private static Scanner s;

public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
}
} Main private static Scanner s; s public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
} main {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
} s = new Scanner(System.in) s new Scanner(System.in) int a = s.nextInt(); a s.nextInt() s.nextInt s int[] b = new int[a]; b new int[a] a for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
		b[i] = s.nextInt();
	} {
		b[i] = s.nextInt();
	} b[i] = s.nextInt() b[i] b i s.nextInt() s.nextInt s int c = s.nextInt(); c s.nextInt() s.nextInt s int[] d = new int[c]; d new int[c] c for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	} int i = 0; int i = 0; i 0 i < c i c i++ i++ i {
		d[i] = s.nextInt();
	} {
		d[i] = s.nextInt();
	} d[i] = s.nextInt() d[i] d i s.nextInt() s.nextInt s int count = 0; count 0 for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	} int i = 0; int i = 0; i 0 i < c i c i++ i++ i {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	} {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	} int l = 0 l 0 r = a r a m; m while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	} l < r l r {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	} m = (l+r)/2 m (l+r)/2 (l+r) l r 2 if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		} d[i] == b[m] d[i] d i b[m] b m {
			count++;
			break;
		} count++ count break; if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		} d[i] < b[m] d[i] d i b[m] b m {
			r = m;
		} r = m r m {
			l = m + 1;
		} l = m + 1 l m + 1 m 1 System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
private static Scanner s;

public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
}
} public class Main {
private static Scanner s;

public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
}
} Main
import java.util.Scanner;
public class Main {
private static Scanner s;

public static void main(String[] args) {
	s = new Scanner(System.in);
	int a = s.nextInt();
	int[] b = new int[a];
	for(int i = 0;i < a;i++) {
		b[i] = s.nextInt();
	}

	int c = s.nextInt();
	int[] d = new int[c];
	for(int i = 0;i < c;i++) {
		d[i] = s.nextInt();
	}
	int count = 0;

	for(int i = 0;i < c;i++) {
	int l = 0,r = a,m;
	while(l < r) {
		m = (l+r)/2;
		if(d[i] == b[m]) {
			count++;
			break;
		}else if(d[i] < b[m]) {
			r = m;
		}else {
			l = m + 1;
		}
	}
	}
	System.out.println(count);
}
}

