import java.util.Scanner;

public class Main {
    static boolean binary_search (int x, int[] data) {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    }

    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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        }

        System.out.println(cnt);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    static boolean binary_search (int x, int[] data) {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    }

    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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        }

        System.out.println(cnt);
    }
} Main static boolean binary_search (int x, int[] data) {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    } binary_search {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    } int left = 0 left 0 right = data.length; right data.length data data.length while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        } true {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        } int mid = (left + right) / 2; mid (left + right) / 2 (left + right) left right 2 if (left > right) return false; left > right left right return false; false if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            } data[mid] == x data[mid] data mid x {
                return true;
            } return true; true if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            } data[mid] < x data[mid] data mid x {
                left = mid + 1;
            } left = mid + 1 left mid + 1 mid 1 {
                right = mid - 1;
            } right = mid - 1 right mid - 1 mid 1 int x x int[] data data 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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        } int i = 0; int i = 0; i 0 i < q i q ++i ++i i {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        } {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        } int t = scanner.nextInt(); t scanner.nextInt() scanner.nextInt scanner if (binary_search(t, s)) ++cnt; binary_search(t, s) binary_search t s ++cnt cnt System.out.println(cnt) System.out.println System.out System System.out cnt String[] args args public class Main {
    static boolean binary_search (int x, int[] data) {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    }

    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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        }

        System.out.println(cnt);
    }
} public class Main {
    static boolean binary_search (int x, int[] data) {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    }

    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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        }

        System.out.println(cnt);
    }
} Main
import java.util.Scanner;

public class Main {
    static boolean binary_search (int x, int[] data) {
        int left = 0, right = data.length;
        while (true) {
            int mid = (left + right) / 2;

            if (left > right) return false;

            if (data[mid] == x) {
                return true;
            } else if (data[mid] < x) {
                left = mid + 1;
            } else {
                right = mid - 1;
            }
        }
    }

    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) {
            int t = scanner.nextInt();
            if (binary_search(t, s)) ++cnt;
        }

        System.out.println(cnt);
    }
}
