import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	}
	public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	}
	
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	}
	public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	}
	
} Main public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n  = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] g  = br.readLine().split(" "); g br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int [] ar = new int[n]; ar new int[n] n for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		} int i = 0 ; int i = 0 ; i 0 i< n i n i++ i++ i {
			ar[i] = Integer.parseInt(g[i]);
		} {
			ar[i] = Integer.parseInt(g[i]);
		} ar[i] = Integer.parseInt(g[i]) ar[i] ar i Integer.parseInt(g[i]) Integer.parseInt Integer g[i] g i int m  = Integer.parseInt(br.readLine()); m Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int ans = 0; ans 0 g  = br.readLine().split(" ") g br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		} int i = 0 ; int i = 0 ; i 0 i <m i m i++ i++ i {
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		} {
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		} if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ; binarySearch(ar,Integer.parseInt(g[i])) != -1 binarySearch(ar,Integer.parseInt(g[i])) binarySearch ar Integer.parseInt(g[i]) Integer.parseInt Integer g[i] g i -1 1 ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	} binarySearch {
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	} int len = c.length; len c.length c c.length int left = 0 left 0 right = len; right len int mid = (right + left) / 2 ; mid (right + left) / 2 (right + left) right left 2 while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		} left < right left right {
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		} if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  } c[mid] == key c[mid] c mid key return mid; mid if(c[mid] < key) left = mid+1;
			else { right = mid;  } c[mid] < key c[mid] c mid key left = mid+1 left mid+1 mid 1 { right = mid;  } right = mid right mid mid = (right + left) / 2 mid (right + left) / 2 (right + left) right left 2 return -1; -1 1 int[] c c int key key public class Main
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	}
	public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	}
	
} public class Main
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	}
	public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	}
	
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	}
	public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	}
	
}