For this Question: Given an array Arr, of N integers find the sum of max(A[i], A[j]) for all i, j such that i < j.The first line of the input contains an integer N, the size of the array.
The second line of the input contains N integers, the elements of the array Arr.

<b>Constraints:</b>
1 <= N <= 100000
1 <= Arr[i] <= 100000000Print a single integer which is the sum of min(A[i], A[j]) for all i, j such that i < j.Sample Input 1
4
5 3 3 1

Sample Output 1
24

Sample Input 2
2
1 10

Sample Output 2
10

<b>Explanation 1</b>
max(5,3) + max(5,3) + max(5,1) + max(3,3) + max(3,1) + max(3,1) = 24
, I have written this Solution Code: n=int(input())
arr=list(map(int,input().split()))
arr.sort(reverse=True)
l=[]
for i in range(n-1):
	l.append(arr[i]*((n-1)-i))
print(sum(l)), In this Programming Language: Python, Now tell me if this Code is compilable or not?