import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    }
    
    public static boolean isContain(int num, int[] ary) {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    }
    
    public static boolean isContain(int num, int[] ary) {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ary = new int[n]; ary new int[n] n for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            ary[i] = sc.nextInt();
        } {
            ary[i] = sc.nextInt();
        } ary[i] = sc.nextInt() ary[i] ary i sc.nextInt() sc.nextInt sc n = sc.nextInt() n sc.nextInt() sc.nextInt sc int[] t = new int[n]; t new int[n] n for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n 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 res = 0; res 0 for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (isContain(t[i], ary)) {
                res++;
            }
        } {
            if (isContain(t[i], ary)) {
                res++;
            }
        } if (isContain(t[i], ary)) {
                res++;
            } isContain(t[i], ary) isContain t[i] t i ary {
                res++;
            } res++ res System.out.println(res) System.out.println System.out System System.out res String[] args args public static boolean isContain(int num, int[] ary) {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    } isContain {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    } int head = 0; head 0 int tail = ary.length-1; tail ary.length-1 ary.length ary ary.length 1 int middle = (head + tail) / 2; middle (head + tail) / 2 (head + tail) head tail 2 while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        } middle != head middle head {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        } int m = ary[middle]; m ary[middle] ary middle if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            } m == num m num {
                return true;
            } return true; true if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            } m < num m num {
                head = middle;
            } head = middle head middle if (m > num) {
                tail = middle;
            } m > num m num {
                tail = middle;
            } tail = middle tail middle middle = (head + tail) / 2 middle (head + tail) / 2 (head + tail) head tail 2 return ary[head] == num || ary[tail] == num; ary[head] == num || ary[tail] == num ary[head] == num ary[head] ary head num ary[tail] == num ary[tail] ary tail num int num num int[] ary ary public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    }
    
    public static boolean isContain(int num, int[] ary) {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    }
    
    public static boolean isContain(int num, int[] ary) {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ary = new int[n];
        
        for (int i = 0; i < n; i++) {
            ary[i] = sc.nextInt();
        }
        
        n = sc.nextInt();
        int[] t = new int[n];
        
        for (int i = 0; i < n; i++) {
            t[i] = sc.nextInt();
        }
        
        int res = 0;
        for (int i = 0; i < n; i++) {
            if (isContain(t[i], ary)) {
                res++;
            }
        }
        
        System.out.println(res);
    }
    
    public static boolean isContain(int num, int[] ary) {
        int head = 0;
        int tail = ary.length-1;
        int middle = (head + tail) / 2;
        while (middle != head) {
            int m = ary[middle];
            if (m == num) {
                return true;
            } else if (m < num) {
                head = middle;
            } else if (m > num) {
                tail = middle;
            }
            middle = (head + tail) / 2;
        }
        return ary[head] == num || ary[tail] == num;
    }
}