import java.util.*;
class Main{
	static int BinarySearch(int[] data, int key){
		int result = -1;
		int r = data.length-1;
		int l = 0;
		while(result == -1 && l <= r){
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		}
		if (result>=0){
			return 1;
		}else{
			return 0;
		}
 
	}
	public static void main(String[] args){
		int count = 0;
		Scanner x=new Scanner(System.in);
	    int s1 = x.nextInt();
		int[] r1=new int[s1+1];
		for(int i=0;i<s1;i++){
		    r1[i]=x.nextInt();
		}
	    int s2 = x.nextInt();
		int[] r2=new int[s2];
		for(int j=0;j<s2;j++){
		    r2[j]=x.nextInt();
		}
		x.close();
		if(s1<s2){
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		}else if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		}
		System.out.println(count);
	}
} import java.util.*; util.* java class Main{
	static int BinarySearch(int[] data, int key){
		int result = -1;
		int r = data.length-1;
		int l = 0;
		while(result == -1 && l <= r){
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		}
		if (result>=0){
			return 1;
		}else{
			return 0;
		}
 
	}
	public static void main(String[] args){
		int count = 0;
		Scanner x=new Scanner(System.in);
	    int s1 = x.nextInt();
		int[] r1=new int[s1+1];
		for(int i=0;i<s1;i++){
		    r1[i]=x.nextInt();
		}
	    int s2 = x.nextInt();
		int[] r2=new int[s2];
		for(int j=0;j<s2;j++){
		    r2[j]=x.nextInt();
		}
		x.close();
		if(s1<s2){
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		}else if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		}
		System.out.println(count);
	}
} Main static int BinarySearch(int[] data, int key){
		int result = -1;
		int r = data.length-1;
		int l = 0;
		while(result == -1 && l <= r){
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		}
		if (result>=0){
			return 1;
		}else{
			return 0;
		}
 
	} BinarySearch {
		int result = -1;
		int r = data.length-1;
		int l = 0;
		while(result == -1 && l <= r){
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		}
		if (result>=0){
			return 1;
		}else{
			return 0;
		}
 
	} int result = -1; result -1 1 int r = data.length-1; r data.length-1 data.length data data.length 1 int l = 0; l 0 while(result == -1 && l <= r){
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		} result == -1 && l <= r result == -1 result -1 1 l <= r l r {
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		} int middle = (l+r)/2; middle (l+r)/2 (l+r) l r 2 if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			} data[middle]<key data[middle] data middle key {
			    l = middle + 1;
			} l = middle + 1 l middle + 1 middle 1 if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			} data[middle] > key data[middle] data middle key {
				r = middle - 1;
			} r = middle - 1 r middle - 1 middle 1 {
				result = middle ;
			} result = middle result middle if (result>=0){
			return 1;
		}else{
			return 0;
		} result>=0 result 0 {
			return 1;
		} return 1; 1 {
			return 0;
		} return 0; 0 int[] data data int key key public static void main(String[] args){
		int count = 0;
		Scanner x=new Scanner(System.in);
	    int s1 = x.nextInt();
		int[] r1=new int[s1+1];
		for(int i=0;i<s1;i++){
		    r1[i]=x.nextInt();
		}
	    int s2 = x.nextInt();
		int[] r2=new int[s2];
		for(int j=0;j<s2;j++){
		    r2[j]=x.nextInt();
		}
		x.close();
		if(s1<s2){
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		}else if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		}
		System.out.println(count);
	} main {
		int count = 0;
		Scanner x=new Scanner(System.in);
	    int s1 = x.nextInt();
		int[] r1=new int[s1+1];
		for(int i=0;i<s1;i++){
		    r1[i]=x.nextInt();
		}
	    int s2 = x.nextInt();
		int[] r2=new int[s2];
		for(int j=0;j<s2;j++){
		    r2[j]=x.nextInt();
		}
		x.close();
		if(s1<s2){
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		}else if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		}
		System.out.println(count);
	} int count = 0; count 0 Scanner x=new Scanner(System.in); x new Scanner(System.in) int s1 = x.nextInt(); s1 x.nextInt() x.nextInt x int[] r1=new int[s1+1]; r1 new int[s1+1] s1+1 s1 1 for(int i=0;i<s1;i++){
		    r1[i]=x.nextInt();
		} int i=0; int i=0; i 0 i<s1 i s1 i++ i++ i {
		    r1[i]=x.nextInt();
		} {
		    r1[i]=x.nextInt();
		} r1[i]=x.nextInt() r1[i] r1 i x.nextInt() x.nextInt x int s2 = x.nextInt(); s2 x.nextInt() x.nextInt x int[] r2=new int[s2]; r2 new int[s2] s2 for(int j=0;j<s2;j++){
		    r2[j]=x.nextInt();
		} int j=0; int j=0; j 0 j<s2 j s2 j++ j++ j {
		    r2[j]=x.nextInt();
		} {
		    r2[j]=x.nextInt();
		} r2[j]=x.nextInt() r2[j] r2 j x.nextInt() x.nextInt x x.close() x.close x if(s1<s2){
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		}else if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		} s1<s2 s1 s2 {
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		} for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		} int i=0; int i=0; i 0 i<s1 i s1 i++ i++ i {
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		} {
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		} if(BinarySearch(r1,r2[i])==1){
				count++;
			} BinarySearch(r1,r2[i])==1 BinarySearch(r1,r2[i]) BinarySearch r1 r2[i] r2 i 1 {
				count++;
			} count++ count if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		} s1>s2 s1 s2 {
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		} for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			} int j=0; int j=0; j 0 j<s2 j s2 j++ j++ j {
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			} {
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			} if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       } BinarySearch(r1,r2[j])==1 BinarySearch(r1,r2[j]) BinarySearch r1 r2[j] r2 j 1 {
				    count++;	
		       } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.*;
class Main{
	static int BinarySearch(int[] data, int key){
		int result = -1;
		int r = data.length-1;
		int l = 0;
		while(result == -1 && l <= r){
			int middle = (l+r)/2;
			if(data[middle]<key){
			    l = middle + 1;
			}else if(data[middle] > key){
				r = middle - 1;
			}else{
				result = middle ;
			}
		}
		if (result>=0){
			return 1;
		}else{
			return 0;
		}
 
	}
	public static void main(String[] args){
		int count = 0;
		Scanner x=new Scanner(System.in);
	    int s1 = x.nextInt();
		int[] r1=new int[s1+1];
		for(int i=0;i<s1;i++){
		    r1[i]=x.nextInt();
		}
	    int s2 = x.nextInt();
		int[] r2=new int[s2];
		for(int j=0;j<s2;j++){
		    r2[j]=x.nextInt();
		}
		x.close();
		if(s1<s2){
		for(int i=0;i<s1;i++){
			if(BinarySearch(r1,r2[i])==1){
				count++;
			}
		}
		}else if(s1>s2){
			for(int j=0;j<s2;j++){
			    if(BinarySearch(r1,r2[j])==1){
				    count++;	
		       }
			}
		}
		System.out.println(count);
	}
}
