import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    }
} Main public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    } main {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    } try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        } {
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int [] S = new int[n]; S new int[n] n for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	} int i=0; int i=0; i 0 i<n i n i++ i++ i {
        		S[i] = sc.nextInt();
        	} {
        		S[i] = sc.nextInt();
        	} S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int [] T = new int[q]; T new int[q] q for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	} int i=0; int i=0; i 0 i<q i q i++ i++ i {
        		T[i] = sc.nextInt();
        	} {
        		T[i] = sc.nextInt();
        	} T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int C = 0; C 0 for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	} int i=0; int i=0; i 0 i<q i q i++ i++ i {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	} {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	} int low = 0; low 0 int high = n; high n System.out.println(C) System.out.println System.out System System.out C String[] args args public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    }
} public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    }
} Main
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)){
        	int n = sc.nextInt();
        	int [] S = new int[n];
        	for(int i=0;i<n;i++) {
        		S[i] = sc.nextInt();
        	}
        	
        	int q = sc.nextInt();
        	int [] T = new int[q];
        	for(int i=0;i<q;i++) {
        		T[i] = sc.nextInt();
        	}
        	int C = 0;
        	for(int i=0;i<q;i++) {
        		int low = 0;
            	int high = n;
        		loop:while(low<high) {
        			int mid = (low+high)/2;
        			if(S[mid]==T[i]) {
        				C++;
        				break loop;
        			}
        			else if(S[mid]>T[i]) high=mid;
        			else if(S[mid]<T[i]) low=mid+1;
        		}
        	}
        	System.out.println(C);
        }
    }
}
