You have an array of length n consisting of elements a1, a2, ..., ap. Each element can be replaced by any integer at most once. The cost of replacing the number x by y is equal to (x-y)^2 coins. Elements are replaced independently, that is, if ai = aj and both elements are replaced, then you have to pay for exactly two replacements.
What is the minimum number of coins needed to make all the elements of the array equal?
The format of the input data
The first line of the input contains an integer n, representing the length of the array. (1 <= n <= 100)) The second line contains n integers a1, a2, ... ap (-100 <= a <= 100).
Output format
Output the minimum number of coins to spend to make all elements equal. Provide exactly two different responses that are separated with 6 asterisk symbols: ******.
user