n = int(input()) num = list(map(int,input().split())) max_n,min_n = num[0],num[0] step = [[-1,1]] def measure(index,limit): cost = 0 for i in range(n): cost += abs(num[i]-index) if cost>limit: return float("inf") return cost for i in range(n): if max_nnum[i]: min_n=num[i] x = 2 while xc: index += i cost = c break print(cost)