import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int finded = 0;
		int lineSamount = scan.nextInt();
		int[] lineSnum = new int[lineSamount];
		for(int i=0; i<lineSamount; i++){
			lineSnum[i] = scan.nextInt();
		}
		int lineTamount = scan.nextInt();
		int[] lineTnum = new int[lineTamount+1];
		for(int i=0; i<lineTamount; i++){
			lineTnum[i] = scan.nextInt();
		}

		for(int i=0; i<lineTamount; i++){
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		}
		System.out.println(finded);
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int finded = 0;
		int lineSamount = scan.nextInt();
		int[] lineSnum = new int[lineSamount];
		for(int i=0; i<lineSamount; i++){
			lineSnum[i] = scan.nextInt();
		}
		int lineTamount = scan.nextInt();
		int[] lineTnum = new int[lineTamount+1];
		for(int i=0; i<lineTamount; i++){
			lineTnum[i] = scan.nextInt();
		}

		for(int i=0; i<lineTamount; i++){
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		}
		System.out.println(finded);
	}
} Main public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int finded = 0;
		int lineSamount = scan.nextInt();
		int[] lineSnum = new int[lineSamount];
		for(int i=0; i<lineSamount; i++){
			lineSnum[i] = scan.nextInt();
		}
		int lineTamount = scan.nextInt();
		int[] lineTnum = new int[lineTamount+1];
		for(int i=0; i<lineTamount; i++){
			lineTnum[i] = scan.nextInt();
		}

		for(int i=0; i<lineTamount; i++){
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		}
		System.out.println(finded);
	} main {
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int finded = 0;
		int lineSamount = scan.nextInt();
		int[] lineSnum = new int[lineSamount];
		for(int i=0; i<lineSamount; i++){
			lineSnum[i] = scan.nextInt();
		}
		int lineTamount = scan.nextInt();
		int[] lineTnum = new int[lineTamount+1];
		for(int i=0; i<lineTamount; i++){
			lineTnum[i] = scan.nextInt();
		}

		for(int i=0; i<lineTamount; i++){
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		}
		System.out.println(finded);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int finded = 0; finded 0 int lineSamount = scan.nextInt(); lineSamount scan.nextInt() scan.nextInt scan int[] lineSnum = new int[lineSamount]; lineSnum new int[lineSamount] lineSamount for(int i=0; i<lineSamount; i++){
			lineSnum[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<lineSamount i lineSamount i++ i++ i {
			lineSnum[i] = scan.nextInt();
		} {
			lineSnum[i] = scan.nextInt();
		} lineSnum[i] = scan.nextInt() lineSnum[i] lineSnum i scan.nextInt() scan.nextInt scan int lineTamount = scan.nextInt(); lineTamount scan.nextInt() scan.nextInt scan int[] lineTnum = new int[lineTamount+1]; lineTnum new int[lineTamount+1] lineTamount+1 lineTamount 1 for(int i=0; i<lineTamount; i++){
			lineTnum[i] = scan.nextInt();
		} int i=0; int i=0; i 0 i<lineTamount i lineTamount i++ i++ i {
			lineTnum[i] = scan.nextInt();
		} {
			lineTnum[i] = scan.nextInt();
		} lineTnum[i] = scan.nextInt() lineTnum[i] lineTnum i scan.nextInt() scan.nextInt scan for(int i=0; i<lineTamount; i++){
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		} int i=0; int i=0; i 0 i<lineTamount i lineTamount i++ i++ i {
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		} {
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		} int left = 0 ; left 0 int right = lineSamount; right lineSamount int mid = lineSamount / 2 ; mid lineSamount / 2 lineSamount 2 while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			} left<right left right {
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			} int move = 0; move 0 int plusmove = 0; plusmove 0 int minusmove = 1; minusmove 1 mid = (left+right)/2 mid (left+right)/2 (left+right) left right 2 if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				} lineTnum[i] == lineSnum[mid] lineTnum[i] lineTnum i lineSnum[mid] lineSnum mid {
//					System.out.println("found!");
					finded++;
					break;
				} finded++ finded break; if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				} lineTnum[i] < lineSnum[mid] lineTnum[i] lineTnum i lineSnum[mid] lineSnum mid {
					right = mid;
				} right = mid right mid if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				} lineTnum[i] > lineSnum[mid] lineTnum[i] lineTnum i lineSnum[mid] lineSnum mid {
					left = mid+1;
				} left = mid+1 left mid+1 mid 1 System.out.println(finded) System.out.println System.out System System.out finded String[] args args
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
//		System.out.println(" ");
		Scanner scan = new Scanner(System.in);
		int finded = 0;
		int lineSamount = scan.nextInt();
		int[] lineSnum = new int[lineSamount];
		for(int i=0; i<lineSamount; i++){
			lineSnum[i] = scan.nextInt();
		}
		int lineTamount = scan.nextInt();
		int[] lineTnum = new int[lineTamount+1];
		for(int i=0; i<lineTamount; i++){
			lineTnum[i] = scan.nextInt();
		}

		for(int i=0; i<lineTamount; i++){
			int left = 0 ;
			int right = lineSamount;
			int mid = lineSamount / 2 ;
			
			while(left<right){
				int move = 0;
				int plusmove = 0;
				int minusmove = 1;
//				System.out.println(left+" L R "+right);/
				mid = (left+right)/2;
				if(lineTnum[i] == lineSnum[mid]){
//					System.out.println("found!");
					finded++;
					break;
				}
				else if(lineTnum[i] < lineSnum[mid]){
					right = mid;
				}
				else if(lineTnum[i] > lineSnum[mid]){
					left = mid+1;
				}
//				System.out.println("mid = "+mid);
			}
//			System.out.println("ende");
		}
		System.out.println(finded);
	}
}