#abc194c. [abc194_c]Squared Error
[abc194_c]Squared Error
Problem Statement
Given is a number sequence of length .
Find the sum of squared differences of every pair of elements: $\\displaystyle \\sum_{i = 2}^{N} \\sum_{j = 1}^{i - 1} (A_i - A_j)^2$.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3
2 8 4
Sample Output 1
56
We have $\\sum_{i = 2}^{N} \\sum_{j = 1}^{i - 1} (A_i - A_j)^2 = (8 - 2)^2 + (4 - 2) ^ 2 + (4 - 8) ^ 2 = 56$.
Sample Input 2
5
-5 8 9 -4 -3
Sample Output 2
950