import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

//5-3 二分探索
public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	}
} import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	}
} Main public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc ArrayList<Integer> S = new ArrayList<>(); S new ArrayList<>() for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S.add(Integer.parseInt(sc.next()));
		} {
			S.add(Integer.parseInt(sc.next()));
		} S.add(Integer.parseInt(sc.next())) S.add S Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int q = Integer.parseInt(sc.next()); q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc ArrayList<Integer> T = new ArrayList<>(); T new ArrayList<>() for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T.add(Integer.parseInt(sc.next()));
		} {
			T.add(Integer.parseInt(sc.next()));
		} T.add(Integer.parseInt(sc.next())) T.add T Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sc.close() sc.close sc int i = 0; i 0 int count = 0; count 0 while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		} i != T.size() i T.size() T.size T {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		} int left = 0; left 0 int right = S.size(); right S.size() S.size S int key = T.get(i); key T.get(i) T.get T i while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			} left < right left right {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				} S.get(mid) == key S.get(mid) S.get S mid key {
					count++;
					break;
				} count++ count break; if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				} key < S.get(mid) key S.get(mid) S.get S mid {
					right = mid;
				} right = mid right mid {
					left = mid + 1;
				} left = mid + 1 left mid + 1 mid 1 i++ i System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	}
} Main
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

//5-3 二分探索
public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		ArrayList<Integer> S = new ArrayList<>();
		for(int i = 0; i < n; i++) {
			S.add(Integer.parseInt(sc.next()));
		}
		int q = Integer.parseInt(sc.next());
		ArrayList<Integer> T = new ArrayList<>();
		for(int i = 0; i < q; i++) {
			T.add(Integer.parseInt(sc.next()));
		}
		sc.close();

		//二分探索
		int i = 0;
		int count = 0;
		while(i != T.size()) {
			int left = 0;
			int right = S.size();
			int key = T.get(i);
			while(left < right) {
				int mid = (left + right) / 2;
				if(S.get(mid) == key) {
					count++;
					break;
				}else if(key < S.get(mid)) {
					right = mid;
				}else {
					left = mid + 1;
				}
			}
			i++;
		}
		System.out.println(count);
	}
}
