import java.util.*;

public class Main{
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  }
} import java.util.*; util.* java public class Main{
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  } main {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int cnt = 0; cnt 0 int[] num = new int[n]; num new int[n] n for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i< n i n i++ i++ i {
			num[i] = sc.nextInt();
		} {
			num[i] = sc.nextInt();
		} num[i] = sc.nextInt() num[i] num i sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		} int i = 0; int i = 0; i 0 i<m i m i++ i++ i {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		} {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc if (Arrays.binarySearch(num, a) > -1)
				cnt++; Arrays.binarySearch(num, a) > -1 Arrays.binarySearch(num, a) Arrays.binarySearch Arrays num a -1 1 cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main{
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  }
} public class Main{
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  }
} Main
import java.util.*;

public class Main{
	public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
    int cnt = 0;
		int[] num = new int[n];

		for(int i=0; i< n;i++) {
			num[i] = sc.nextInt();
		}
    int m = sc.nextInt();
		for(int i = 0;i<m;i++) {
			int a = sc.nextInt();
			if (Arrays.binarySearch(num, a) > -1)
				cnt++;
		}
		System.out.println(cnt);
  }
}
