§ Sum of absolute differences of an array

D = 
|s[1] - s[2]| + |s[1] - s[3]| + |s[1] - s[4]| +
|s[2] - s[3]| + |s[2] - s[4]| +
|s[3] - s[4]|
D = 
(s[2] - s[1]) + (s[3] - s[1]) + (s[4] - s[1]) +
(s[3] - s[2]) + (s[4] - s[2]) +
(s[4] - s[3])