import java.io.*;
import java.util.Arrays;
import java.util.*;

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Deque<Integer> stack = new ArrayDeque<Integer>();
		String[] str = (br.readLine()).split(" ");
		int count = 0;
		for (int i = 0 ; i<n ; i++ ) {
			stack.addLast(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		String[] st = (br.readLine()).split(" ");
		int[] num = new int[q];
		for (int i = 0; i<q ; i++ ) {
			num[i] = Integer.parseInt(st[i]);
		}

		Arrays.sort(num);

		int a;
		try{

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		}catch (NullPointerException e){

		}

		System.out.println(count);
	}

} import java.io.*; io.* java import java.util.Arrays; Arrays java.util import java.util.*; util.* java class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Deque<Integer> stack = new ArrayDeque<Integer>();
		String[] str = (br.readLine()).split(" ");
		int count = 0;
		for (int i = 0 ; i<n ; i++ ) {
			stack.addLast(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		String[] st = (br.readLine()).split(" ");
		int[] num = new int[q];
		for (int i = 0; i<q ; i++ ) {
			num[i] = Integer.parseInt(st[i]);
		}

		Arrays.sort(num);

		int a;
		try{

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		}catch (NullPointerException e){

		}

		System.out.println(count);
	}

} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Deque<Integer> stack = new ArrayDeque<Integer>();
		String[] str = (br.readLine()).split(" ");
		int count = 0;
		for (int i = 0 ; i<n ; i++ ) {
			stack.addLast(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		String[] st = (br.readLine()).split(" ");
		int[] num = new int[q];
		for (int i = 0; i<q ; i++ ) {
			num[i] = Integer.parseInt(st[i]);
		}

		Arrays.sort(num);

		int a;
		try{

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		}catch (NullPointerException e){

		}

		System.out.println(count);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Deque<Integer> stack = new ArrayDeque<Integer>();
		String[] str = (br.readLine()).split(" ");
		int count = 0;
		for (int i = 0 ; i<n ; i++ ) {
			stack.addLast(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		String[] st = (br.readLine()).split(" ");
		int[] num = new int[q];
		for (int i = 0; i<q ; i++ ) {
			num[i] = Integer.parseInt(st[i]);
		}

		Arrays.sort(num);

		int a;
		try{

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		}catch (NullPointerException e){

		}

		System.out.println(count);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br Deque<Integer> stack = new ArrayDeque<Integer>(); stack new ArrayDeque<Integer>() String[] str = (br.readLine()).split(" "); str (br.readLine()).split(" ") (br.readLine()).split (br.readLine()) br.readLine br " " int count = 0; count 0 for (int i = 0 ; i<n ; i++ ) {
			stack.addLast(Integer.parseInt(str[i]));
		} int i = 0 ; int i = 0 ; i 0 i<n i n i++ i++ i {
			stack.addLast(Integer.parseInt(str[i]));
		} {
			stack.addLast(Integer.parseInt(str[i]));
		} stack.addLast(Integer.parseInt(str[i])) stack.addLast stack Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] st = (br.readLine()).split(" "); st (br.readLine()).split(" ") (br.readLine()).split (br.readLine()) br.readLine br " " int[] num = new int[q]; num new int[q] q for (int i = 0; i<q ; i++ ) {
			num[i] = Integer.parseInt(st[i]);
		} int i = 0; int i = 0; i 0 i<q i q i++ i++ i {
			num[i] = Integer.parseInt(st[i]);
		} {
			num[i] = Integer.parseInt(st[i]);
		} num[i] = Integer.parseInt(st[i]) num[i] num i Integer.parseInt(st[i]) Integer.parseInt Integer st[i] st i Arrays.sort(num) Arrays.sort Arrays num int a; a try{

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		}catch (NullPointerException e){

		} catch (NullPointerException e){

		} NullPointerException e {

		} {

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		} for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			} int i = 0; int i = 0; i 0 i<q i q i++ i++ i {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			} {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			} while((a = stack.pollFirst()) < num[i]); (a = stack.pollFirst()) < num[i] (a = stack.pollFirst()) a stack.pollFirst() stack.pollFirst stack num[i] num i if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				} num[i] == a num[i] num i a {
					count++;	
				} count++ count {

					stack.addFirst(a);
					continue;
				} stack.addFirst(a) stack.addFirst stack a continue; System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.io.*;
import java.util.Arrays;
import java.util.*;

class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		Deque<Integer> stack = new ArrayDeque<Integer>();
		String[] str = (br.readLine()).split(" ");
		int count = 0;
		for (int i = 0 ; i<n ; i++ ) {
			stack.addLast(Integer.parseInt(str[i]));
		}
		int q = Integer.parseInt(br.readLine());
		String[] st = (br.readLine()).split(" ");
		int[] num = new int[q];
		for (int i = 0; i<q ; i++ ) {
			num[i] = Integer.parseInt(st[i]);
		}

		Arrays.sort(num);

		int a;
		try{

			for (int i = 0; i<q ; i++ ) {
				while((a = stack.pollFirst()) < num[i]);
				if (num[i] == a) {
					count++;	
				}else{

					stack.addFirst(a);
					continue;
				}
			}
		}catch (NullPointerException e){

		}

		System.out.println(count);
	}

}