import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        }
        Arrays.sort(s);
        int q = scanner.nextInt();
        int[] t = new int[n];
        for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        }

        int ans = 0;
        for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        }
        Arrays.sort(s);
        int q = scanner.nextInt();
        int[] t = new int[n];
        for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        }

        int ans = 0;
        for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        }
        Arrays.sort(s);
        int q = scanner.nextInt();
        int[] t = new int[n];
        for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        }

        int ans = 0;
        for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        }
        System.out.println(ans);
    } main {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        }
        Arrays.sort(s);
        int q = scanner.nextInt();
        int[] t = new int[n];
        for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        }

        int ans = 0;
        for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        }
        System.out.println(ans);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int[] s = new int[n]; s new int[n] n for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            s[i] = scanner.nextInt();
        } {
            s[i] = scanner.nextInt();
        } s[i] = scanner.nextInt() s[i] s i scanner.nextInt() scanner.nextInt scanner Arrays.sort(s) Arrays.sort Arrays s int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int[] t = new int[n]; t new int[n] n for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            t[i] = scanner.nextInt();
        } {
            t[i] = scanner.nextInt();
        } t[i] = scanner.nextInt() t[i] t i scanner.nextInt() scanner.nextInt scanner int ans = 0; ans 0 for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        } {
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        } int target = t[i]; target t[i] t i int head = 0; head 0 int tail = n-1; tail n-1 n 1 while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            } head <= tail head tail {
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            } int middle = (head + tail)/2; middle (head + tail)/2 (head + tail) head tail 2 if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;} s[middle] == target s[middle] s middle target {ans++;break;} ans++ ans break; if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;} s[middle] < target s[middle] s middle target {head = middle+1;} head = middle+1 head middle+1 middle 1 {tail = middle-1;} tail = middle-1 tail middle-1 middle 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] s = new int[n];
        for(int i = 0; i < n; i++){
            s[i] = scanner.nextInt();
        }
        Arrays.sort(s);
        int q = scanner.nextInt();
        int[] t = new int[n];
        for(int i = 0; i < q; i++){
            t[i] = scanner.nextInt();
        }

        int ans = 0;
        for(int i = 0; i < q; i++){
            int target = t[i];
            int head = 0;
            int tail = n-1;
            while(head <= tail){
                int middle = (head + tail)/2;
                //System.out.println(s[middle]);
                if(s[middle] == target){ans++;break;}
                else if(s[middle] < target){head = middle+1;}
                else{tail = middle-1;}
                
            }
        }
        System.out.println(ans);
    }
}
