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

class Main {
    static boolean binarySearch(int[] x, int index, int start, int end) {
        if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        }
        
        int mid = (start + end) / 2;
        
        if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        }
        
        return false; //unreachable
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
        
        int result = 0;
        
        int num     = Integer.parseInt(br_num.readLine());
        int[] array = new int[num];
        String[] inputs_nums = br_num.readLine().split(" ");
        
        for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        }
        
        int q = Integer.parseInt(br_num.readLine());
        String[] inputs_numt = br_num.readLine().split(" ");
        for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        }
        
        System.out.println(result);
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
    static boolean binarySearch(int[] x, int index, int start, int end) {
        if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        }
        
        int mid = (start + end) / 2;
        
        if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        }
        
        return false; //unreachable
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
        
        int result = 0;
        
        int num     = Integer.parseInt(br_num.readLine());
        int[] array = new int[num];
        String[] inputs_nums = br_num.readLine().split(" ");
        
        for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        }
        
        int q = Integer.parseInt(br_num.readLine());
        String[] inputs_numt = br_num.readLine().split(" ");
        for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        }
        
        System.out.println(result);
    }
} Main static boolean binarySearch(int[] x, int index, int start, int end) {
        if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        }
        
        int mid = (start + end) / 2;
        
        if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        }
        
        return false; //unreachable
    } binarySearch {
        if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        }
        
        int mid = (start + end) / 2;
        
        if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        }
        
        return false; //unreachable
    } if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        } start >= end start end {
            if(x[start] != index) {
                return false;
            }
        } if(x[start] != index) {
                return false;
            } x[start] != index x[start] x start index {
                return false;
            } return false; false int mid = (start + end) / 2; mid (start + end) / 2 (start + end) start end 2 if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        } x[mid] == index x[mid] x mid index {
            return true;
        } return true; true if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        } x[mid] > index x[mid] x mid index {
            return binarySearch(x, index, start, mid - 1);
        } return binarySearch(x, index, start, mid - 1); binarySearch(x, index, start, mid - 1) binarySearch x index start mid - 1 mid 1 if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        } x[mid] < index x[mid] x mid index {
            return binarySearch(x, index, mid + 1, end);
        } return binarySearch(x, index, mid + 1, end); binarySearch(x, index, mid + 1, end) binarySearch x index mid + 1 mid 1 end return false; //unreachable false int[] x x int index index int start start int end end public static void main(String[] args) throws IOException {
        BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
        
        int result = 0;
        
        int num     = Integer.parseInt(br_num.readLine());
        int[] array = new int[num];
        String[] inputs_nums = br_num.readLine().split(" ");
        
        for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        }
        
        int q = Integer.parseInt(br_num.readLine());
        String[] inputs_numt = br_num.readLine().split(" ");
        for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        }
        
        System.out.println(result);
    } main {
        BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
        
        int result = 0;
        
        int num     = Integer.parseInt(br_num.readLine());
        int[] array = new int[num];
        String[] inputs_nums = br_num.readLine().split(" ");
        
        for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        }
        
        int q = Integer.parseInt(br_num.readLine());
        String[] inputs_numt = br_num.readLine().split(" ");
        for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        }
        
        System.out.println(result);
    } BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in)); br_num new BufferedReader(new InputStreamReader(System.in)) int result = 0; result 0 int num     = Integer.parseInt(br_num.readLine()); num Integer.parseInt(br_num.readLine()) Integer.parseInt Integer br_num.readLine() br_num.readLine br_num int[] array = new int[num]; array new int[num] num String[] inputs_nums = br_num.readLine().split(" "); inputs_nums br_num.readLine().split(" ") br_num.readLine().split br_num.readLine() br_num.readLine br_num " " for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            array[i] = Integer.parseInt(inputs_nums[i]);
        } {
            array[i] = Integer.parseInt(inputs_nums[i]);
        } array[i] = Integer.parseInt(inputs_nums[i]) array[i] array i Integer.parseInt(inputs_nums[i]) Integer.parseInt Integer inputs_nums[i] inputs_nums i int q = Integer.parseInt(br_num.readLine()); q Integer.parseInt(br_num.readLine()) Integer.parseInt Integer br_num.readLine() br_num.readLine br_num String[] inputs_numt = br_num.readLine().split(" "); inputs_numt br_num.readLine().split(" ") br_num.readLine().split br_num.readLine() br_num.readLine br_num " " for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        } String numt inputs_numt {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        } {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        } if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            } binarySearch(array, Integer.parseInt(numt), 0, num - 1) binarySearch array Integer.parseInt(numt) Integer.parseInt Integer numt 0 num - 1 num 1 {
                result++;
            } result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {
    static boolean binarySearch(int[] x, int index, int start, int end) {
        if(start >= end) {
            if(x[start] != index) {
                return false;
            }
        }
        
        int mid = (start + end) / 2;
        
        if(x[mid] == index) {
            return true;
        }else if(x[mid] > index) {
            return binarySearch(x, index, start, mid - 1);
        }else if(x[mid] < index) {
            return binarySearch(x, index, mid + 1, end);
        }
        
        return false; //unreachable
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br_num = new BufferedReader(new InputStreamReader(System.in));
        
        int result = 0;
        
        int num     = Integer.parseInt(br_num.readLine());
        int[] array = new int[num];
        String[] inputs_nums = br_num.readLine().split(" ");
        
        for(int i = 0; i < num; i++) {
            array[i] = Integer.parseInt(inputs_nums[i]);
        }
        
        int q = Integer.parseInt(br_num.readLine());
        String[] inputs_numt = br_num.readLine().split(" ");
        for(String numt : inputs_numt) {
            if(binarySearch(array, Integer.parseInt(numt), 0, num - 1)) {
                result++;
            }
        }
        
        System.out.println(result);
    }
}
