import java.util.Scanner;

public class Main {
	
	static int[] s;
	static int tt;
	static int ans;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	}
	
	private static void binarySearch(int startIndex, int endIndex) {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	static int[] s;
	static int tt;
	static int ans;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	}
	
	private static void binarySearch(int startIndex, int endIndex) {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	}
} Main static int[] s; s static int tt; tt static int ans; ans public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc s = new int[n] s new int[n] n for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			s[i] = sc.nextInt();
		} {
			s[i] = sc.nextInt();
		} s[i] = sc.nextInt() s[i] s i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] t = new int[q]; t new int[q] q for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			t[i] = sc.nextInt();
		} {
			t[i] = sc.nextInt();
		} t[i] = sc.nextInt() t[i] t i sc.nextInt() sc.nextInt sc ans = 0 ans 0 for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			tt = t[i];
			binarySearch(0, n - 1);
		} {
			tt = t[i];
			binarySearch(0, n - 1);
		} tt = t[i] tt t[i] t i binarySearch(0, n - 1) binarySearch 0 n - 1 n 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args private static void binarySearch(int startIndex, int endIndex) {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	} binarySearch {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	} int index = (startIndex + endIndex) / 2; index (startIndex + endIndex) / 2 (startIndex + endIndex) startIndex endIndex 2 if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		} s[index] == tt s[index] s index tt {
			ans++;
			return;
		} ans++ ans return; if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		} startIndex == endIndex startIndex endIndex {
			return;
		} return; if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		} s[index] > tt s[index] s index tt {
			binarySearch(startIndex, index);
		} binarySearch(startIndex, index) binarySearch startIndex index if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		} s[index] < tt s[index] s index tt {
			binarySearch(index + 1, endIndex);
		} binarySearch(index + 1, endIndex) binarySearch index + 1 index 1 endIndex int startIndex startIndex int endIndex endIndex public class Main {
	
	static int[] s;
	static int tt;
	static int ans;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	}
	
	private static void binarySearch(int startIndex, int endIndex) {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	}
} public class Main {
	
	static int[] s;
	static int tt;
	static int ans;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	}
	
	private static void binarySearch(int startIndex, int endIndex) {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	
	static int[] s;
	static int tt;
	static int ans;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.nextInt();
		}
		int q = sc.nextInt();
		int[] t = new int[q];
		for (int i = 0; i < q; i++) {
			t[i] = sc.nextInt();
		}
		
		ans = 0;
		for (int i = 0; i < q; i++) {
			tt = t[i];
			binarySearch(0, n - 1);
		}
		System.out.println(ans);
	}
	
	private static void binarySearch(int startIndex, int endIndex) {
		int index = (startIndex + endIndex) / 2;
		if (s[index] == tt) {
			ans++;
			return;
		} else if (startIndex == endIndex) {
			return;
		} else if (s[index] > tt) {
			binarySearch(startIndex, index);
		} else if (s[index] < tt) {
			binarySearch(index + 1, endIndex);
		}
	}
}