import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int [] s = new int[n]; s new int[n] n int [] t; t for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        } int x = 0; int x = 0; x 0 x < n x n x++ x++ x {
            s[x] = scan.nextInt();
        } {
            s[x] = scan.nextInt();
        } s[x] = scan.nextInt() s[x] s x scan.nextInt() scan.nextInt scan int q = scan.nextInt(); q scan.nextInt() scan.nextInt scan t = new int[q] t new int[q] q for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        } int x = 0; int x = 0; x 0 x < q x q x++ x++ x {
            t[x] = scan.nextInt();
        } {
            t[x] = scan.nextInt();
        } t[x] = scan.nextInt() t[x] t x scan.nextInt() scan.nextInt scan int counter = 0; counter 0 for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        } int x = 0; int x = 0; x 0 x < q x q x++ x++ x {
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        } {
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        } if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            } t[x] <= s[n -1] && t[x] >= s[0] t[x] <= s[n -1] t[x] t x s[n -1] s n -1 n 1 t[x] >= s[0] t[x] t x s[0] s 0 {
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            } if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                } binarysearch(s, 0, n - 1, t[x]) binarysearch s 0 n - 1 n 1 t[x] t x {
                    counter++;
                } counter++ counter System.out.println(counter) System.out.println System.out System System.out counter String[] args args public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    } binarysearch {
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    } if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        } r >=l r l {
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        } int mid = (l + r)/2; mid (l + r)/2 (l + r) l r 2 if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            } arr[mid] == x arr[mid] arr mid x {
                return true;
            } return true; true if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            } arr[mid] > x arr[mid] arr mid x {
                return binarysearch(arr, l, mid -1, x);
            } return binarysearch(arr, l, mid -1, x); binarysearch(arr, l, mid -1, x) binarysearch arr l mid -1 mid 1 x {
                return binarysearch(arr, mid + 1, r, x);
            } return binarysearch(arr, mid + 1, r, x); binarysearch(arr, mid + 1, r, x) binarysearch arr mid + 1 mid 1 r x {
         return false;
        } return false; false int arr[] arr int l l int r r int x x public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
} public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int [] s = new int[n];
        int [] t;
        for (int x = 0; x < n; x++){
            s[x] = scan.nextInt();
        }
        int q = scan.nextInt();
        t = new int[q];
        for (int x = 0; x < q; x++){
            t[x] = scan.nextInt();
        }
        int counter = 0;
        for (int x = 0; x < q; x++){
            if(t[x] <= s[n -1] && t[x] >= s[0]){
                if(binarysearch(s, 0, n - 1, t[x])){
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
    public static boolean binarysearch(int arr[], int l, int r, int x){
        if(r >=l){
            int mid = (l + r)/2;
            if(arr[mid] == x){
                return true;
            }
            else if(arr[mid] > x){
                return binarysearch(arr, l, mid -1, x);
            }
            else{
                return binarysearch(arr, mid + 1, r, x);
            }
        }
        else{
         return false;
        }
    }
}
