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

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n n q q A[] = new int[100000] A new int[100000] 100000 m[] = new int[50000]; m new int[50000] 50000 n = sc.nextInt() n sc.nextInt() sc.nextInt sc for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			A[i] = sc.nextInt();
		} {
			A[i] = sc.nextInt();
		} A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc q = sc.nextInt() q sc.nextInt() sc.nextInt sc for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			m[i] = sc.nextInt();
		} {
			m[i] = sc.nextInt();
		} m[i] = sc.nextInt() m[i] m i sc.nextInt() sc.nextInt sc int ans = 0; ans 0 for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		} int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		} {
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		} int ok = -1; ok -1 1 int ng = n; ng n boolean aru = false; aru false while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = 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] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			} int mid = (ok + ng) / 2; mid (ok + ng) / 2 (ok + ng) ok ng 2 if(A[mid] == m[i])
				{
					aru = true;
					break;
				} A[mid] == m[i] A[mid] A mid m[i] m i {
					aru = true;
					break;
				} aru = true aru true break; if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				} A[mid] > m[i] A[mid] A mid m[i] m i {
					ng = mid;
				} ng = mid ng mid {
					ok = mid;
				} ok = mid ok mid if(aru)
			{
				++ans;
			} aru {
				++ans;
			} ++ans ans System.out.println(ans) System.out.println System.out System System.out ans sc.close() sc.close sc String args[] args public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	}
} public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	}
} Main
import java.util.Scanner;
import java.util.Arrays;
import java.util.List;

public class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		int n, q, A[] = new int[100000], m[] = new int[50000];
		n = sc.nextInt();
		for(int i = 0; i < n; i++)
		{
			A[i] = sc.nextInt();
		}
		q = sc.nextInt();
		for(int i = 0; i < q; i++)
		{
			m[i] = sc.nextInt();
		}
		int ans = 0;
		for(int i = 0; i < q; i++)
		{
			int ok = -1;
			int ng = n;
			boolean aru = false;
			while(Math.abs(ok - ng) > 1)
			{
				int mid = (ok + ng) / 2;
				if(A[mid] == m[i])
				{
					aru = true;
					break;
				}
				if(A[mid] > m[i])
				{
					ng = mid;
				}
				else
				{
					ok = mid;
				}
			}
			if(aru)
			{
				++ans;
			}
		}
		System.out.println(ans);
		sc.close();
	}
}
