#abc186d. [abc186_d]Sum of difference
[abc186_d]Sum of difference
Problem Statement
Given are integers .
Find the sum of over all pairs such that .
In other words, find $\\displaystyle{\\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} |A_i-A_j|}$.
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
5 1 2
Sample Output 1
8
We have .
Sample Input 2
5
31 41 59 26 53
Sample Output 2
176