def main():
    input()
    a = set(input().split())
    input()
    b = set(input().split())
    print(len(a.intersection(b)))


if __name__ == "__main__":
    import os
    import sys
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main() def main():
    input()
    a = set(input().split())
    input()
    b = set(input().split())
    print(len(a.intersection(b))) main input() input a = set(input().split()) a set(input().split()) set input().split() ().split () input split input() input b = set(input().split()) b set(input().split()) set input().split() ().split () input split print(len(a.intersection(b))) print len(a.intersection(b)) len a.intersection(b) a.intersection a intersection b if __name__ == "__main__":
    import os
    import sys
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main() __name__ == "__main__" __name__ "__main__" import os os import sys sys if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main() len(sys.argv) > 1 len(sys.argv) len sys.argv sys argv 1 if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
     sys.argv[1] == "-d" sys.argv[1] sys.argv sys argv 1 "-d" fd = os.open("input.txt", os.O_RDONLY) fd os.open("input.txt", os.O_RDONLY) os.open os open "input.txt" os.O_RDONLY os O_RDONLY os.dup2(fd, sys.stdin.fileno()) os.dup2 os dup2 fd sys.stdin.fileno() sys.stdin.fileno sys.stdin sys stdin fileno main() main main() main fd = os.open("input.txt", os.O_RDONLY) os.open("input.txt", os.O_RDONLY) fd def main():
    input()
    a = set(input().split())
    input()
    b = set(input().split())
    print(len(a.intersection(b))) def main():
    input()
    a = set(input().split())
    input()
    b = set(input().split())
    print(len(a.intersection(b))) main
def main():
    input()
    a = set(input().split())
    input()
    b = set(input().split())
    print(len(a.intersection(b)))


if __name__ == "__main__":
    import os
    import sys
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            fd = os.open("input.txt", os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main()