/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=jp
 */
import java.util.*;
import java.util.Arrays;

public class Main {
	
	boolean binSearch(int[] s, int x, int a, int b) {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	}
	
	void run() {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}
 import java.util.*; util.* java import java.util.Arrays; Arrays java.util public class Main {
	
	boolean binSearch(int[] s, int x, int a, int b) {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	}
	
	void run() {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} Main boolean binSearch(int[] s, int x, int a, int b) {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	} binSearch {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	} int left = 0; left 0 int right = s.length; right s.length s s.length while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		} left < right left right {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1; s[mid] == x s[mid] s mid x return true; true if (s[mid] > x) right = mid;
			else left = mid + 1; s[mid] > x s[mid] s mid x right = mid right mid left = mid + 1 left mid + 1 mid 1 return false; false int[] s s int x x int a a int b b void run() {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		System.out.println(cnt);
	} run {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		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 Arrays.sort(s) Arrays.sort Arrays s int cnt = 0; cnt 0 for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		} {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		} if (binSearch(s, t[i], 0, s.length - 1)) cnt++; binSearch(s, t[i], 0, s.length - 1) binSearch s t[i] t i 0 s.length - 1 s.length s s.length 1 cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	} main {
		// TODO Auto-generated method stub
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	
	boolean binSearch(int[] s, int x, int a, int b) {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	}
	
	void run() {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} public class Main {
	
	boolean binSearch(int[] s, int x, int a, int b) {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	}
	
	void run() {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

} Main
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_4_B&lang=jp
 */
import java.util.*;
import java.util.Arrays;

public class Main {
	
	boolean binSearch(int[] s, int x, int a, int b) {
		int left = 0;
		int right = s.length;
		while (left < right) {
			int mid = (left + right) / 2;
			if (s[mid] == x) return true;
			else if (s[mid] > x) right = mid;
			else left = mid + 1;
		}
		return false;
	}
	
	void run() {
		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();
		}
		Arrays.sort(s);
		
		int cnt = 0;
		for (int i = 0; i < q; i++) {
			if (binSearch(s, t[i], 0, s.length - 1)) cnt++;
		}
		System.out.println(cnt);
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		new Main().run();
	}

}

