import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) br.readLine() br.readLine br String[] tmp = br.readLine().split(" "); tmp br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " List<Integer> S = new ArrayList<Integer>(); S new ArrayList<Integer>() S.add(Integer.parseInt(tmp[0])) S.add S Integer.parseInt(tmp[0]) Integer.parseInt Integer tmp[0] tmp 0 for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		} int i = 1; int i = 1; i 1 i < tmp.length i tmp.length tmp tmp.length i++ i++ i {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		} {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		} if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i])); !tmp[i].equals(tmp[i - 1]) tmp[i].equals(tmp[i - 1]) tmp[i].equals tmp[i] tmp i tmp[i - 1] tmp i - 1 i 1 S.add(Integer.parseInt(tmp[i])) S.add S Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i br.readLine() br.readLine br String[] T = br.readLine().split(" "); T br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int cnt = 0; cnt 0 for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		} String s T {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		} {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		} if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			} Collections.binarySearch(S, Integer.parseInt(s)) >= 0 Collections.binarySearch(S, Integer.parseInt(s)) Collections.binarySearch Collections S Integer.parseInt(s) Integer.parseInt Integer s 0 {
				cnt++;
			} cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt if (br != null) {
			br.close();
			br = null;
		} br != null br null {
			br.close();
			br = null;
		} br.close() br.close br br = null br null String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		br.readLine();
		String[] tmp = br.readLine().split(" ");
		List<Integer> S = new ArrayList<Integer>();
		S.add(Integer.parseInt(tmp[0]));
		for (int i = 1; i < tmp.length; i++) {
			if (!tmp[i].equals(tmp[i - 1]))
				S.add(Integer.parseInt(tmp[i]));
		}
		br.readLine();
		String[] T = br.readLine().split(" ");

		int cnt = 0;
		for (String s : T) {
			if (Collections.binarySearch(S, Integer.parseInt(s)) >= 0) {
				cnt++;
			}
		}
		System.out.println(cnt);

		if (br != null) {
			br.close();
			br = null;
		}
	}
}