不愧是python,两行代码搞定

n = int(input())
print(" ".join(str(i) for i in sorted(list(map(int,input().split())),reverse=1)[0:5] ))