import java.util.*;

public class Main{
	static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	}

	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	}
}
 import java.util.*; util.* java public class Main{
	static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	}

	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	}
} Main static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	} search {
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	} int left = 0 ; left 0 int right = l.length; right l.length l l.length int mid ; mid while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		} left < right left right {
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		} mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			} l[mid] == key l[mid] l mid key {
				return mid;
			} return mid; mid if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			} l[mid] < key l[mid] l mid key {
				left = mid +1 ;
			} left = mid +1 left mid +1 mid 1 if(key < l[mid]){
				right = mid;
			} key < l[mid] key l[mid] l mid {
				right = mid;
			} right = mid right mid return -1 ; -1 1 int[] l l int key key public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	} main {
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] l = new int[n]; l new int[n] n for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				l[i]=scanner.nextInt();
			} {
				l[i]=scanner.nextInt();
			} l[i]=scanner.nextInt() l[i] l i scanner.nextInt() scanner.nextInt scanner int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int sum = 0; sum 0 for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    } {
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    } if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					} search(l, scanner.nextInt() ) >= 0 search(l, scanner.nextInt() ) search l scanner.nextInt() scanner.nextInt scanner 0 {
						sum++;
					} sum++ sum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main{
	static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	}

	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	}
} public class Main{
	static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	}

	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	}
} Main
import java.util.*;

public class Main{
	static int search(int[] l,int key){
		int left = 0 ;
		int right = l.length;
		int mid ;
		
		while(left < right){
			mid = (left + right) / 2 ;
			if(l[mid] == key){
				return mid;
			}
			else if(l[mid] < key){
				left = mid +1 ;
			}
			else if(key < l[mid]){
				right = mid;
			}
		}
		return -1 ;
	}

	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);

	    int n = scanner.nextInt();
	    int[] l = new int[n];
	    for(int i = 0; i < n; i++){
				l[i]=scanner.nextInt();
			}

	    int q = scanner.nextInt();
	    int sum = 0;

	    for(int i = 0; i < q; i++){
	        if(search(l, scanner.nextInt() ) >= 0){
						sum++;
					}
	    }

	    System.out.println(sum);
	}
}

