Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- res = 0
- N = sorted(list(map(int, input().split())))
- while len(N) != 0:
- res += (N[0] + N[-1]) ** 2
- N.pop(0)
- N.pop(-1)
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement