import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    }

    private static int binarySearch(int[] /*sorted*/ array, int target) {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                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 = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    }

    private static int binarySearch(int[] /*sorted*/ array, int target) {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return -1;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] S = new int[n]; S new int[n] n for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            S[i] = sc.nextInt();
        } {
            S[i] = sc.nextInt();
        } S[i] = sc.nextInt() S[i] S i sc.nextInt() sc.nextInt sc int q = sc.nextInt(); q sc.nextInt() sc.nextInt sc int[] T = new int[q]; T new int[q] q for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            T[i] = sc.nextInt();
        } {
            T[i] = sc.nextInt();
        } T[i] = sc.nextInt() T[i] T i sc.nextInt() sc.nextInt sc int count = 0; count 0 for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        } int i = 0; int i = 0; i 0 i < T.length i T.length T T.length i++ i++ i {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        } {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        } if (binarySearch(S, T[i]) != -1) {
                count++;
            } binarySearch(S, T[i]) != -1 binarySearch(S, T[i]) binarySearch S T[i] T i -1 1 {
                count++;
            } count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args private static int binarySearch(int[] /*sorted*/ array, int target) {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return -1;
    } binarySearch {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return -1;
    } int left = 0; left 0 int right = array.length; right array.length array array.length int mid; mid while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            }
        } left < right left right {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            }
        } mid = (left + right) / 2 mid (left + right) / 2 (left + right) left right 2 if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            } array[mid] == target array[mid] array mid target {
                return mid;
            } return mid; mid if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            } array[mid] > target array[mid] array mid target {
                right = mid;
            } right = mid right mid {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 return -1; -1 1 int[] /*sorted*/ array array int target target public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    }

    private static int binarySearch(int[] /*sorted*/ array, int target) {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                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 = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    }

    private static int binarySearch(int[] /*sorted*/ array, int target) {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                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 = sc.nextInt();
        int[] S = new int[n];
        for (int i = 0; i < n; i++) {
            S[i] = sc.nextInt();
        }
        int q = sc.nextInt();
        int[] T = new int[q];
        for (int i = 0; i < q; i++) {
            T[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < T.length; i++) {
            if (binarySearch(S, T[i]) != -1) {
                count++;
            }
        }
        System.out.println(count);
    }

    private static int binarySearch(int[] /*sorted*/ array, int target) {
        int left = 0;
        int right = array.length;
        int mid;
        while (left < right) {
            mid = (left + right) / 2;
            if (array[mid] == target) {
                return mid;
            } else if (array[mid] > target) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }
        return -1;
    }
}