import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	}
}

 import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int a[] = new int[114514]; a new int[114514] 114514 for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			a[i] = scan.nextInt();
		} {
			a[i] = scan.nextInt();
		} a[i] = scan.nextInt() a[i] a i scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan int ans = 0; ans 0 for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		} int i=0; int i=0; i 0 i<q i q i++ i++ i {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		} {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		} int key = scan.nextInt(); key scan.nextInt() scan.nextInt scan int ng = -1; ng -1 1 int ok = n; ok n while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			} Math.abs(ok-ng) > 1 Math.abs(ok-ng) Math.abs Math ok-ng ok ng 1 {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			} int mid = (ok+ng)/2; mid (ok+ng)/2 (ok+ng) ok ng 2 if (a[mid] >= key) ok = mid;
				else ng = mid; a[mid] >= key a[mid] a mid key ok = mid ok mid ng = mid ng mid if (a[ok]==key) ans++; a[ok]==key a[ok] a ok key ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a[] = new int[114514];
		
		for (int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		
		int q = scan.nextInt();
		int ans = 0;
		for (int i=0; i<q; i++) {
			int key = scan.nextInt();
			int ng = -1; int ok = n;
			while (Math.abs(ok-ng) > 1) {
				int mid = (ok+ng)/2;
				if (a[mid] >= key) ok = mid;
				else ng = mid;
			}
			if (a[ok]==key) ans++;
		}
		
		System.out.println(ans);
	}
}


