
import java.util.Arrays;
import java.util.Scanner;

import javax.sound.midi.MidiChannel;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	}

	
	public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util import javax.sound.midi.MidiChannel; MidiChannel javax.sound.midi public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	}

	
	public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int[] S = new int[n]; S new int[n] n for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			S[i] = scan.nextInt();
		} {
			S[i] = scan.nextInt();
		} S[i] = scan.nextInt() S[i] S i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int[] T = new int[q]; T new int[q] q for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
			T[i] = scan.nextInt();
		} {
			T[i] = scan.nextInt();
		} T[i] = scan.nextInt() T[i] T i scan.nextInt() scan.nextInt scan int count = 0; count 0 for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		} int t T {
			if (binarySearch2(S, t)) {
				count++;
			}		
		} {
			if (binarySearch2(S, t)) {
				count++;
			}		
		} if (binarySearch2(S, t)) {
				count++;
			} binarySearch2(S, t) binarySearch2 S t {
				count++;
			} count++ count System.out.println(count) System.out.println System.out System System.out count scan.close() scan.close scan String[] args args public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	} binarySearch2 {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	} boolean ans = false; ans false int left = 0; left 0 int right = S.length; right S.length S S.length while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		} left < right left right {
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		} int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			} S[mid] == key S[mid] S mid key {
				return true;
			} return true; true if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			} key < S[mid] key S[mid] S mid {
				right = mid;
			} right = mid right mid {
				left = mid + 1;
			} left = mid + 1 left mid + 1 mid 1 return ans; ans int[] S S int key key public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	}

	
	public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	}

	
	public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	}
} Main

import java.util.Arrays;
import java.util.Scanner;

import javax.sound.midi.MidiChannel;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] S = new int[n];
		for (int i = 0; i < n; i++) {
			S[i] = scan.nextInt();
		}
		int q = scan.nextInt();
		int[] T = new int[q];
		for (int i = 0; i < T.length; i++) {
			T[i] = scan.nextInt();
		}
		int count = 0;
		for(int t: T){
			if (binarySearch2(S, t)) {
				count++;
			}		
		}
		
		System.out.println(count);
		scan.close();
	}

	
	public static boolean binarySearch2(int[] S, int key) {
		boolean ans = false;
		int left = 0;
		int right = S.length;
		while(left < right){
			int mid = (left + right) / 2;
			if (S[mid] == key) {
				return true;
			}else if (key < S[mid]) {
				right = mid;
			}else{
				left = mid + 1;
			}
		}
		return ans;
		
	}
}