import java.util.Scanner;

public 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    private static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
} import java.util.Scanner; Scanner java.util public 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    private static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
} 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    } 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    } 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 int q = scanner.nextInt(); q scanner.nextInt() scanner.nextInt scanner int cnt = 0; cnt 0 for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        } int i = 0; int i = 0; i 0 i < q i q i++ i++ i {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        } {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        } if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            } binarySearch(S, scanner.nextInt()) != -1 binarySearch(S, scanner.nextInt()) binarySearch S scanner.nextInt() scanner.nextInt scanner -1 1 {
                cnt++;
            } cnt++ cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args private static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    } binarySearch {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    } int lo = 0; lo 0 int hi = a.length - 1; hi a.length - 1 a.length a a.length 1 while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        } lo <= hi lo hi {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        } int mid = (lo + hi) / 2; mid (lo + hi) / 2 (lo + hi) lo hi 2 if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            } a[mid] > key a[mid] a mid key {
                hi = mid - 1;
            } hi = mid - 1 hi mid - 1 mid 1 if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            } a[mid] < key a[mid] a mid key {
                lo = mid + 1;
            } lo = mid + 1 lo mid + 1 mid 1 {
                return mid;
            } return mid; mid return -1; -1 1 int[] a a int key key public 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    private static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
} public 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    private static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
} Main
import java.util.Scanner;

public 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();
        }
        int q = scanner.nextInt();
        int cnt = 0;
        for (int i = 0; i < q; i++) {
            if (binarySearch(S, scanner.nextInt()) != -1) {
                cnt++;
            }
        }
        System.out.println(cnt);
    }

    private static int binarySearch(int[] a, int key) {
        int lo = 0;
        int hi = a.length - 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            if (a[mid] > key) {
                hi = mid - 1;
            } else if (a[mid] < key) {
                lo = mid + 1;
            } else {
                return mid;
            }
        }
        return -1;
    }
}