import java.io.*;

public class Main{

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	}

	private static boolean binarySearch(int key, int[] A, int n){
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	}
} import java.io.*; io.* java public class Main{

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	}

	private static boolean binarySearch(int key, int[] A, int n){
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	}
} Main public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	} 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 int[] S = new int[n+1]; S new int[n+1] n+1 n 1 String[] ins = br.readLine().split(" "); ins br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = Integer.parseInt(ins[i]);
		} {
			S[i] = Integer.parseInt(ins[i]);
		} S[i] = Integer.parseInt(ins[i]) S[i] S i Integer.parseInt(ins[i]) Integer.parseInt Integer ins[i] ins i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] T = new int[q]; T new int[q] q ins = br.readLine().split(" ") ins br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			T[i] = Integer.parseInt(ins[i]);
		} {
			T[i] = Integer.parseInt(ins[i]);
		} T[i] = Integer.parseInt(ins[i]) T[i] T i Integer.parseInt(ins[i]) Integer.parseInt Integer ins[i] ins i int C = 0; C 0 for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		} {
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		} boolean flag = binarySearch(T[i], S, n); flag binarySearch(T[i], S, n) binarySearch T[i] T i S n if(flag == true)
				C++; flag == true flag true C++ C System.out.printf("%d\n", C) System.out.printf System.out System System.out "%d\n" C String[] args args private static boolean binarySearch(int key, int[] A, int n){
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	} binarySearch {
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	} int left = 0; left 0 int right = n; right n while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		} left < right left right {
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1; A[mid] == key A[mid] A mid key return true; true if(key < A[mid])
				right = mid;
			else
				left = mid + 1; key < A[mid] key A[mid] A mid right = mid right mid left = mid + 1 left mid + 1 mid 1 return false; false int key key int[] A A int n n public class Main{

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	}

	private static boolean binarySearch(int key, int[] A, int n){
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	}
} public class Main{

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	}

	private static boolean binarySearch(int key, int[] A, int n){
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	}
} Main
import java.io.*;

public class Main{

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

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] S = new int[n+1];
		String[] ins = br.readLine().split(" ");
		for(int i = 0; i < n; i++){
			S[i] = Integer.parseInt(ins[i]);
		}
		int q = Integer.parseInt(br.readLine());
		int[] T = new int[q];
		ins = br.readLine().split(" ");
		for(int i = 0; i < q; i++){
			T[i] = Integer.parseInt(ins[i]);
		}

		int C = 0;
		for(int i = 0; i < T.length; i++){
			boolean flag = binarySearch(T[i], S, n);
			if(flag == true)
				C++;
		}
		System.out.printf("%d\n", C);
	}

	private static boolean binarySearch(int key, int[] A, int n){
		int left = 0;
		int right = n;
		while(left < right){
			int mid = (left + right) / 2;
			if(A[mid] == key)
				return true;
			else if(key < A[mid])
				right = mid;
			else
				left = mid + 1;
		}
		return false;
	}
}