Abs(sum of differences of elements in a sorted array) = array.Max()-array.Min() Why?
If you picture these as distances along a road, it should be very intuitive.

If (for example) you start at kilometer #7, then proceed through kilometers #45, #81, and #97, then the distances you travel are 45−7, then 81−45, then 97−81; and the total distance you travel is 97−7. Since the total distance is the sum of the individual distances, 97−7&nbsp;=&nbsp;(45−7)&nbsp;+&nbsp;(81−45)&nbsp;+&nbsp;(97−81).

This only works for a sorted set, because otherwise you have backtracking, where you cover a certain distance and then "un-cover".