Evi has N integers a_1,a_2,..,a_N. His objective is to have N equal **integers** by transforming some of them.  He may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).  Find the minimum total cost to achieve his objective.
n = int(input())
A = [int(i) for i in input().split()]

x = sum(A)/len(A)
ans = 0
for i in A:
    ans += (i - x)**2
print(-(-ans//1))
n = int(input())
A = [int(i) for i in input().split()]

x = sum(A)/len(A)
totals = []
for i in range(min(A), max(A)+1):
    total = 0
    for a in A:
      total += (a-i)**2
    totals.append(total)
print(min(totals))