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

public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    }

    public static boolean binarySearch(int key, int[] target){
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    }

    public static boolean binarySearch(int key, int[] target){
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    }

} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] s = br.readLine().split(" "); s br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] S = new int[n]; S new int[n] n for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = Integer.parseInt(s[i]);
        } {
            S[i] = Integer.parseInt(s[i]);
        } S[i] = Integer.parseInt(s[i]) S[i] S i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i int q = Integer.parseInt(br.readLine()); q Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] t = br.readLine().split(" "); t br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] T = new int[q]; T new int[q] q for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            T[i] = Integer.parseInt(t[i]);
        } {
            T[i] = Integer.parseInt(t[i]);
        } T[i] = Integer.parseInt(t[i]) T[i] T i Integer.parseInt(t[i]) Integer.parseInt Integer t[i] t i int ans = 0; ans 0 for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        } int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
            if(binarySearch(T[i], S)){
                ans++;
            }
        } {
            if(binarySearch(T[i], S)){
                ans++;
            }
        } if(binarySearch(T[i], S)){
                ans++;
            } binarySearch(T[i], S) binarySearch T[i] T i S {
                ans++;
            } ans++ ans System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static boolean binarySearch(int key, int[] target){
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    } binarySearch {
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    } int left = 0; left 0 int right = target.length; right target.length target target.length int middle; middle while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        } left < right left right {
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        } middle = (left + right) / 2 middle (left + right) / 2 (left + right) left right 2 if(key < target[middle]) right = middle; key < target[middle] key target[middle] target middle right = middle right middle if(key == target[middle]) return true; key == target[middle] key target[middle] target middle return true; true if(key > target[middle]) left = middle + 1; key > target[middle] key target[middle] target middle left = middle + 1 left middle + 1 middle 1 return false; false int key key int[] target target public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    }

    public static boolean binarySearch(int key, int[] target){
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    }

} public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    }

    public static boolean binarySearch(int key, int[] target){
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    }

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

public class Main{

    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] s = br.readLine().split(" ");
        int[] S = new int[n];
        for(int i = 0; i < n; i++){
            S[i] = Integer.parseInt(s[i]);
        }
        int q = Integer.parseInt(br.readLine());
        String[] t = br.readLine().split(" ");
        int[] T = new int[q];
        for(int i = 0; i < q; i++){
            T[i] = Integer.parseInt(t[i]);
        }

        int ans = 0;

        //??°???T???????´??????????????????°???S??¨?????????????????????????????????Binary search??§)         
        for(int i = 0; i < T.length; i++){
            if(binarySearch(T[i], S)){
                ans++;
            }
        }
        System.out.println(ans);
    }

    public static boolean binarySearch(int key, int[] target){
        int left = 0;
        int right = target.length;
        int middle;

        while(left < right){
            middle = (left + right) / 2;
            if(key < target[middle]) right = middle;
            if(key == target[middle]) return true;
            if(key > target[middle]) left = middle + 1;
        }
        return false;
    }

}