import java.util.*;
import java.lang.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] data =new int[n];
        for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        }

        int q = Integer.parseInt(sc.nextLine());
        String[] line2 = sc.nextLine().split(" ");
        int[] searcher = new int[q];
        for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        }

        
        int result = 0;
        for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        }
        System.out.println(result);
        



    }
    static void bubble(int[] arr, int n){

    }
    static void selection(int[] arr, int n){

    }
    static void insertionSort(int[] arr, int n, int g,int count){
        for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        }
    }
    static void shellsort(int[] arr, int n){

        for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        }
    }
}
class Struct{
    String name;
    int time;
    public Struct(String n, int t){
        name = n;
        time = t;
    }
} import java.util.*; util.* java import java.lang.*; lang.* java class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] data =new int[n];
        for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        }

        int q = Integer.parseInt(sc.nextLine());
        String[] line2 = sc.nextLine().split(" ");
        int[] searcher = new int[q];
        for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        }

        
        int result = 0;
        for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        }
        System.out.println(result);
        



    }
    static void bubble(int[] arr, int n){

    }
    static void selection(int[] arr, int n){

    }
    static void insertionSort(int[] arr, int n, int g,int count){
        for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        }
    }
    static void shellsort(int[] arr, int n){

        for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        }
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] data =new int[n];
        for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        }

        int q = Integer.parseInt(sc.nextLine());
        String[] line2 = sc.nextLine().split(" ");
        int[] searcher = new int[q];
        for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        }

        
        int result = 0;
        for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        }
        System.out.println(result);
        



    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] data =new int[n];
        for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        }

        int q = Integer.parseInt(sc.nextLine());
        String[] line2 = sc.nextLine().split(" ");
        int[] searcher = new int[q];
        for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        }

        
        int result = 0;
        for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        }
        System.out.println(result);
        



    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] line = sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] data =new int[n]; data new int[n] n for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        } int i=0; int i=0; i 0 i < n i n i++ i++ i {
            data[i] = Integer.parseInt(line[i]);
        } {
            data[i] = Integer.parseInt(line[i]);
        } data[i] = Integer.parseInt(line[i]) data[i] data i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i int q = Integer.parseInt(sc.nextLine()); q Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] line2 = sc.nextLine().split(" "); line2 sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] searcher = new int[q]; searcher new int[q] q for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        } int i=0; int i=0; i 0 i < q i q i++ i++ i {
            searcher[i] = Integer.parseInt(line2[i]);
        } {
            searcher[i] = Integer.parseInt(line2[i]);
        } searcher[i] = Integer.parseInt(line2[i]) searcher[i] searcher i Integer.parseInt(line2[i]) Integer.parseInt Integer line2[i] line2 i int result = 0; result 0 for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        } int search searcher {
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        } {
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        } int left = 0; left 0 int right = n; right n int mid; mid while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            } left < right left right {
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            } mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                } search == data[mid] search data[mid] data mid {
                    result++;
                    break;
                } result++ result break; if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                } search < data[mid] search data[mid] data mid {
                    right = mid;
                } right = mid right mid if(search > data[mid]){
                    left = mid + 1;
                } search > data[mid] search data[mid] data mid {
                    left = mid + 1;
                } left = mid + 1 left mid + 1 mid 1 System.out.println(result) System.out.println System.out System System.out result String args[] args static void bubble(int[] arr, int n){

    } bubble {

    } int[] arr arr int n n static void selection(int[] arr, int n){

    } selection {

    } int[] arr arr int n n static void insertionSort(int[] arr, int n, int g,int count){
        for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        }
    } insertionSort {
        for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        }
    } for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        } int i = g; int i = g; i g i < n i n i++ i++ i {
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        } {
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        } int v = arr[i]; v arr[i] arr i int j = i - g; j i - g i g while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            } j >= 0 && arr[j] > arr[i] j >= 0 j 0 arr[j] > arr[i] arr[j] arr j arr[i] arr i {
                arr[i] = arr[j];
                j-=g;
                count++;
            } arr[i] = arr[j] arr[i] arr i arr[j] arr j j-=g j g count++ count arr[j + g] = v arr[j + g] arr j + g j g v int[] arr arr int n n int g g int count count static void shellsort(int[] arr, int n){

        for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        }
    } shellsort {

        for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        }
    } for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        } int i = 1; int i = 1; i 1 {
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        } {
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        } if(i > n){
                break;
            } i > n i n {
                break;
            } break; i = (i * 3) + 1 i (i * 3) + 1 (i * 3) i 3 1 int[] arr arr int n n class Struct{
    String name;
    int time;
    public Struct(String n, int t){
        name = n;
        time = t;
    }
} Struct String name; name int time; time public Struct(String n, int t){
        name = n;
        time = t;
    } Struct {
        name = n;
        time = t;
    } name = n name n time = t time t String n n int t t
import java.util.*;
import java.lang.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.nextLine());
        String[] line = sc.nextLine().split(" ");
        int[] data =new int[n];
        for(int i=0; i < n; i++){
            data[i] = Integer.parseInt(line[i]);
        }

        int q = Integer.parseInt(sc.nextLine());
        String[] line2 = sc.nextLine().split(" ");
        int[] searcher = new int[q];
        for(int i=0; i < q; i++){
            searcher[i] = Integer.parseInt(line2[i]);
        }

        
        int result = 0;
        for(int search : searcher){
            int left = 0;
            int right = n;
            int mid;
            while(left < right){
                mid = (left + right) / 2;
                if(search == data[mid]){
                    result++;
                    break;
                }else if(search < data[mid]){
                    right = mid;
                }else if(search > data[mid]){
                    left = mid + 1;
                }
            }
        }
        System.out.println(result);
        



    }
    static void bubble(int[] arr, int n){

    }
    static void selection(int[] arr, int n){

    }
    static void insertionSort(int[] arr, int n, int g,int count){
        for(int i = g; i < n; i++){
            int v = arr[i];
            int j = i - g;
            while(j >= 0 && arr[j] > arr[i]){
                arr[i] = arr[j];
                j-=g;
                count++;
            }
            arr[j + g] = v;
        }
    }
    static void shellsort(int[] arr, int n){

        for(int i = 1; ; ){
            if(i > n){
                break;
            }

            i = (i * 3) + 1;
        }
    }
}
class Struct{
    String name;
    int time;
    public Struct(String n, int t){
        name = n;
        time = t;
    }
}