import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashSet; HashSet java.util import java.util.Set; Set java.util public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int size = Integer.parseInt(br.readLine()); size Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br Set<String> set = new HashSet<String>(); set new HashSet<String>() String[] strInputNums = br.readLine().split(" "); strInputNums br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		} int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		} {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		} if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			} !set.contains(strInputNums[i]) set.contains(strInputNums[i]) set.contains set strInputNums[i] strInputNums i {
				set.add(strInputNums[i]);
			} set.add(strInputNums[i]) set.add set strInputNums[i] strInputNums i size = Integer.parseInt(br.readLine()) size Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br strInputNums = br.readLine().split(" ") strInputNums br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int matchCnt = 0; matchCnt 0 for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		} int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		} {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		} if (set.contains(strInputNums[i])) {
				matchCnt++;
			} set.contains(strInputNums[i]) set.contains set strInputNums[i] strInputNums i {
				matchCnt++;
			} matchCnt++ matchCnt System.out.println(matchCnt) System.out.println System.out System System.out matchCnt String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int size = Integer.parseInt(br.readLine());
		Set<String> set = new HashSet<String>();
		String[] strInputNums = br.readLine().split(" ");
		for (int i = 0; i < size; i++) {
			if (!set.contains(strInputNums[i])) {
				set.add(strInputNums[i]);
			}
		}
		size = Integer.parseInt(br.readLine());
		strInputNums = br.readLine().split(" ");
		int matchCnt = 0;
		for (int i = 0; i < size; i++) {
			if (set.contains(strInputNums[i])) {
				matchCnt++;
			}
		}
		System.out.println(matchCnt);
	}
}