import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
} Main public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    } main {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] s = new int[n]; s new int[n] n for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = Integer.parseInt(sc.next());
        } {
            s[i] = Integer.parseInt(sc.next());
        } s[i] = Integer.parseInt(sc.next()) s[i] s i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int q = Integer.parseInt(sc.next()); q Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int c = 0; c 0 for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        } {
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        } int x = binarySearch(s, n, Integer.parseInt(sc.next())); x binarySearch(s, n, Integer.parseInt(sc.next())) binarySearch s n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if(x != -1) c++; x != -1 x -1 1 c++ c System.out.println(c) System.out.println System.out System System.out c String[] args args static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    } binarySearch {
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    } int left = 0; left 0 int right = n; right n while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        } left < right left right {
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            } a[mid] == key a[mid] a mid key {
                return mid;
            } return mid; mid if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            } key < a[mid] key a[mid] a mid {
                right = mid;
            } right = mid right mid {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 return -1; -1 1 int[] a a int n n int key key public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
} public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = Integer.parseInt(sc.next());
        }
        int q = Integer.parseInt(sc.next());
        int c = 0;
        for(int i = 0; i < q; i++){
            int x = binarySearch(s, n, Integer.parseInt(sc.next()));
            if(x != -1) c++;
        }
        
        System.out.println(c);
    }
    
    static int binarySearch(int[] a, int n, int key){
        
        int left = 0;
        int right = n;
        
        while(left < right){
            int mid = (left + right) / 2;
            if(a[mid] == key){
                return mid;
            }else if(key < a[mid]){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        return -1;
    }
}
