def main():
    _ = input()
    array_A = input().split()
    _ = input()
    array_B = input().split()

    array_intersection = set(array_A) & set(array_B)

    print(len(array_intersection))

    return


main() def main():
    _ = input()
    array_A = input().split()
    _ = input()
    array_B = input().split()

    array_intersection = set(array_A) & set(array_B)

    print(len(array_intersection))

    return main _ = input() _ input() input array_A = input().split() array_A input().split() ().split () input split _ = input() _ input() input array_B = input().split() array_B input().split() ().split () input split array_intersection = set(array_A) & set(array_B) array_intersection set(array_A) & set(array_B) set(array_A) set array_A set(array_B) set array_B print(len(array_intersection)) print len(array_intersection) len array_intersection return main() main def main():
    _ = input()
    array_A = input().split()
    _ = input()
    array_B = input().split()

    array_intersection = set(array_A) & set(array_B)

    print(len(array_intersection))

    return def main():
    _ = input()
    array_A = input().split()
    _ = input()
    array_B = input().split()

    array_intersection = set(array_A) & set(array_B)

    print(len(array_intersection))

    return main
def main():
    _ = input()
    array_A = input().split()
    _ = input()
    array_B = input().split()

    array_intersection = set(array_A) & set(array_B)

    print(len(array_intersection))

    return


main()
