import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	}
	
	public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	}
} import java.util.Scanner; Scanner java.util public class Main{
	
	public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	}
	
	public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	}
} Main public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	} main {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	} int[] S; S int[] T; T int C = 0; C 0 Scanner keyboard = new Scanner(System.in); keyboard new Scanner(System.in) int S_length = keyboard.nextInt(); S_length keyboard.nextInt() keyboard.nextInt keyboard S = new int[S_length] S new int[S_length] S_length keyboard.nextLine() keyboard.nextLine keyboard String S_inputString = keyboard.nextLine(); S_inputString keyboard.nextLine() keyboard.nextLine keyboard Scanner S_input = new Scanner(S_inputString); S_input new Scanner(S_inputString) int T_length = keyboard.nextInt(); T_length keyboard.nextInt() keyboard.nextInt keyboard T = new int[T_length] T new int[T_length] T_length keyboard.nextLine() keyboard.nextLine keyboard String T_inputString = keyboard.nextLine(); T_inputString keyboard.nextLine() keyboard.nextLine keyboard Scanner T_input = new Scanner(T_inputString); T_input new Scanner(T_inputString) for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		} int i = 0; int i = 0; i 0 i < S_length i S_length i++ i++ i {
			S[i] = S_input.nextInt();
		} {
			S[i] = S_input.nextInt();
		} S[i] = S_input.nextInt() S[i] S i S_input.nextInt() S_input.nextInt S_input for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		} int i = 0; int i = 0; i 0 i < T_length i T_length i++ i++ i {
			T[i] = T_input.nextInt();
		} {
			T[i] = T_input.nextInt();
		} T[i] = T_input.nextInt() T[i] T i T_input.nextInt() T_input.nextInt T_input for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
			if(contains(T[i], S)) C++;
		} {
			if(contains(T[i], S)) C++;
		} if(contains(T[i], S)) C++; contains(T[i], S) contains T[i] T i S C++ C System.out.println(C) System.out.println System.out System System.out C String[] args args public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	} contains {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	} boolean containsInt = false; containsInt false int low_index = 0; low_index 0 int high_index = check.length - 1; high_index check.length - 1 check.length check check.length 1 int middle_index = check.length / 2; middle_index check.length / 2 check.length check check.length 2 while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		} containsInt == false && high_index - low_index > 1 containsInt == false containsInt false high_index - low_index > 1 high_index - low_index high_index low_index 1 {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		} if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			} check[middle_index] == query check[middle_index] check middle_index query {
				containsInt = true;
			} containsInt = true containsInt true if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			} check[middle_index] > query check[middle_index] check middle_index query {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			} high_index = middle_index high_index middle_index middle_index = (high_index + low_index) / 2 middle_index (high_index + low_index) / 2 (high_index + low_index) high_index low_index 2 if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			} check[middle_index] < query check[middle_index] check middle_index query {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			} low_index = middle_index low_index middle_index middle_index = (high_index + low_index) / 2 middle_index (high_index + low_index) / 2 (high_index + low_index) high_index low_index 2 if(check[high_index] == query) {
			containsInt = true;
		} check[high_index] == query check[high_index] check high_index query {
			containsInt = true;
		} containsInt = true containsInt true return containsInt; containsInt int query query int[] check check public class Main{
	
	public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	}
	
	public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	}
} public class Main{
	
	public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	}
	
	public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	}
} Main
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args) {
		
		int[] S;
		int[] T;
		int C = 0;
		
		Scanner keyboard = new Scanner(System.in);
		
		int S_length = keyboard.nextInt();
		S = new int[S_length];
		
		keyboard.nextLine();
		
		String S_inputString = keyboard.nextLine();
		
		Scanner S_input = new Scanner(S_inputString);
		
		int T_length = keyboard.nextInt();
		T = new int[T_length];
		
		keyboard.nextLine();
		
		String T_inputString = keyboard.nextLine();
		
		Scanner T_input = new Scanner(T_inputString);
		
		for(int i = 0; i < S_length; i++) {
			S[i] = S_input.nextInt();
		}
		
		for(int i = 0; i < T_length; i++) {
			T[i] = T_input.nextInt();
		}
		
		for(int i = 0; i < T.length; i++) {
			if(contains(T[i], S)) C++;
		}
		
		System.out.println(C);
		
	}
	
	public static boolean contains(int query, int[] check) {
		
		boolean containsInt = false;
		
		int low_index = 0;
		int high_index = check.length - 1;
		int middle_index = check.length / 2;
//		int iteration = 0;
		
		while(containsInt == false && high_index - low_index > 1) {
			
//			iteration++;
//			
//			System.out.println("----------------");
//			System.out.println("Query: " + query);
//			System.out.println("Iteration: " + iteration);
//			System.out.println("L: " + low_index);
//			System.out.println("M: " + middle_index);
//			System.out.println("H: " + high_index);
			
			if(check[middle_index] == query) {
				containsInt = true;
			}
			else if(check[middle_index] > query) {
				high_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			else if(check[middle_index] < query) {
				low_index = middle_index;
				middle_index = (high_index + low_index) / 2;
			}
			
		}
		
		if(check[high_index] == query) {
			containsInt = true;
		}
		
		return containsInt;
		
	}
}
