import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	}
}

class Slist {
	List<Integer> list = new ArrayList<Integer>();
	boolean sorted = false;

	public Slist(int n) {
		// TODO Auto-generated constructor stub
	}

	public boolean isExist(int e) {
		if (!sorted) {
			Collections.sort(list, null);
			sorted = true;
		}
		return this.bsearch(e, 0, list.size() - 1);
	}

	private boolean bsearch(int e, int min, int max) {
		if (min > max)
			return false;
		int mid = (max + min) / 2;
		if (list.get(mid) > e)
			return bsearch(e, min, mid - 1);
		else if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max);
	}

	public void add(int e) {
		list.add(e);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.File; File java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.FileReader; FileReader java.io import java.io.IOException; IOException java.io import java.lang.management.ManagementFactory; ManagementFactory java.lang.management import java.lang.management.ThreadMXBean; ThreadMXBean java.lang.management import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.Comparator; Comparator java.util import java.util.List; List java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	}
} Main public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	} main {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan Slist s = new Slist(n); s new Slist(n) for (int i = 0; i < n; i++)
			s.add(scan.nextInt()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i s.add(scan.nextInt()); s.add(scan.nextInt()) s.add s scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int cnt = 0; cnt 0 for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++; int i = 0; int i = 0; i 0 i < q i q i++ i++ i if (s.isExist(scan.nextInt()))
				cnt++; if (s.isExist(scan.nextInt()))
				cnt++; s.isExist(scan.nextInt()) s.isExist s scan.nextInt() scan.nextInt scan cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt scan.close() scan.close scan System.exit(0) System.exit System 0 String[] args args class Slist {
	List<Integer> list = new ArrayList<Integer>();
	boolean sorted = false;

	public Slist(int n) {
		// TODO Auto-generated constructor stub
	}

	public boolean isExist(int e) {
		if (!sorted) {
			Collections.sort(list, null);
			sorted = true;
		}
		return this.bsearch(e, 0, list.size() - 1);
	}

	private boolean bsearch(int e, int min, int max) {
		if (min > max)
			return false;
		int mid = (max + min) / 2;
		if (list.get(mid) > e)
			return bsearch(e, min, mid - 1);
		else if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max);
	}

	public void add(int e) {
		list.add(e);
	}

} Slist List<Integer> list = new ArrayList<Integer>(); list new ArrayList<Integer>() boolean sorted = false; sorted false public Slist(int n) {
		// TODO Auto-generated constructor stub
	} Slist {
		// TODO Auto-generated constructor stub
	} int n n public boolean isExist(int e) {
		if (!sorted) {
			Collections.sort(list, null);
			sorted = true;
		}
		return this.bsearch(e, 0, list.size() - 1);
	} isExist {
		if (!sorted) {
			Collections.sort(list, null);
			sorted = true;
		}
		return this.bsearch(e, 0, list.size() - 1);
	} if (!sorted) {
			Collections.sort(list, null);
			sorted = true;
		} !sorted sorted {
			Collections.sort(list, null);
			sorted = true;
		} Collections.sort(list, null) Collections.sort Collections list null sorted = true sorted true return this.bsearch(e, 0, list.size() - 1); this.bsearch(e, 0, list.size() - 1) this.bsearch this e 0 list.size() - 1 list.size() list.size list 1 int e e private boolean bsearch(int e, int min, int max) {
		if (min > max)
			return false;
		int mid = (max + min) / 2;
		if (list.get(mid) > e)
			return bsearch(e, min, mid - 1);
		else if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max);
	} bsearch {
		if (min > max)
			return false;
		int mid = (max + min) / 2;
		if (list.get(mid) > e)
			return bsearch(e, min, mid - 1);
		else if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max);
	} if (min > max)
			return false; min > max min max return false; false int mid = (max + min) / 2; mid (max + min) / 2 (max + min) max min 2 if (list.get(mid) > e)
			return bsearch(e, min, mid - 1);
		else if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max); list.get(mid) > e list.get(mid) list.get list mid e return bsearch(e, min, mid - 1); bsearch(e, min, mid - 1) bsearch e min mid - 1 mid 1 if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max); list.get(mid) == e list.get(mid) list.get list mid e return true; true return bsearch(e, mid + 1, max); bsearch(e, mid + 1, max) bsearch e mid + 1 mid 1 max int e e int min min int max max public void add(int e) {
		list.add(e);
	} add {
		list.add(e);
	} list.add(e) list.add list e int e e public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	}
} public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	}
} Main
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);
		// Scanner scan = new Scanner(new
		// File("D:\\UserArea\\J0124567\\Downloads\\ALDS1_3_C-in10.txt"));
		// while (scan.hasNext()) {

		int n = scan.nextInt();
		Slist s = new Slist(n);
		for (int i = 0; i < n; i++)
			s.add(scan.nextInt());
		int q = scan.nextInt();
		int cnt = 0;
		for (int i = 0; i < q; i++)
			if (s.isExist(scan.nextInt()))
				cnt++;
		System.out.println(cnt);
		scan.close();
		System.exit(0);
	}
}

class Slist {
	List<Integer> list = new ArrayList<Integer>();
	boolean sorted = false;

	public Slist(int n) {
		// TODO Auto-generated constructor stub
	}

	public boolean isExist(int e) {
		if (!sorted) {
			Collections.sort(list, null);
			sorted = true;
		}
		return this.bsearch(e, 0, list.size() - 1);
	}

	private boolean bsearch(int e, int min, int max) {
		if (min > max)
			return false;
		int mid = (max + min) / 2;
		if (list.get(mid) > e)
			return bsearch(e, min, mid - 1);
		else if (list.get(mid) == e)
			return true;
		else
			return bsearch(e, mid + 1, max);
	}

	public void add(int e) {
		list.add(e);
	}

}