def count(xs, ys):
    """Returns a count of elements in xs which is also in ys.

    >>> count([1, 2, 3], [1, 3])
    2
    >>> count([1, 2, 3, 4, 5], [3, 4, 1])
    3
    """
    xset = set(xs)
    yset = set(ys)
    return len(xset & yset)


def run():
    _ = input()  # flake8: noqa
    s = [int(i) for i in input().split()]
    _ = input()  # flake8: noqa
    t = [int(j) for j in input().split()]

    print(count(s, t))


if __name__ == '__main__':
    run()
 def count(xs, ys):
    """Returns a count of elements in xs which is also in ys.

    >>> count([1, 2, 3], [1, 3])
    2
    >>> count([1, 2, 3, 4, 5], [3, 4, 1])
    3
    """
    xset = set(xs)
    yset = set(ys)
    return len(xset & yset) count """Returns a count of elements in xs which is also in ys.

    >>> count([1, 2, 3], [1, 3])
    2
    >>> count([1, 2, 3, 4, 5], [3, 4, 1])
    3
    """ xset = set(xs) xset set(xs) set xs yset = set(ys) yset set(ys) set ys return len(xset & yset) len(xset & yset) len xset & yset xset yset xs xs ys ys def run():
    _ = input()  # flake8: noqa
    s = [int(i) for i in input().split()]
    _ = input()  # flake8: noqa
    t = [int(j) for j in input().split()]

    print(count(s, t)) run _ = input() _ input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i s = [int(i) for i in input().split()] s [int(i) for i in input().split()] _ = input() _ input() input int(j) for j in input().split() for j in input().split() j input().split() ().split () input split for j in input().split() int(j) int j t = [int(j) for j in input().split()] t [int(j) for j in input().split()] print(count(s, t)) print count(s, t) count s t if __name__ == '__main__':
    run() __name__ == '__main__' __name__ '__main__' run() run def count(xs, ys):
    """Returns a count of elements in xs which is also in ys.

    >>> count([1, 2, 3], [1, 3])
    2
    >>> count([1, 2, 3, 4, 5], [3, 4, 1])
    3
    """
    xset = set(xs)
    yset = set(ys)
    return len(xset & yset) def count(xs, ys):
    """Returns a count of elements in xs which is also in ys.

    >>> count([1, 2, 3], [1, 3])
    2
    >>> count([1, 2, 3, 4, 5], [3, 4, 1])
    3
    """
    xset = set(xs)
    yset = set(ys)
    return len(xset & yset) count def run():
    _ = input()  # flake8: noqa
    s = [int(i) for i in input().split()]
    _ = input()  # flake8: noqa
    t = [int(j) for j in input().split()]

    print(count(s, t)) def run():
    _ = input()  # flake8: noqa
    s = [int(i) for i in input().split()]
    _ = input()  # flake8: noqa
    t = [int(j) for j in input().split()]

    print(count(s, t)) run
def count(xs, ys):
    """Returns a count of elements in xs which is also in ys.

    >>> count([1, 2, 3], [1, 3])
    2
    >>> count([1, 2, 3, 4, 5], [3, 4, 1])
    3
    """
    xset = set(xs)
    yset = set(ys)
    return len(xset & yset)


def run():
    _ = input()  # flake8: noqa
    s = [int(i) for i in input().split()]
    _ = input()  # flake8: noqa
    t = [int(j) for j in input().split()]

    print(count(s, t))


if __name__ == '__main__':
    run()

