(defvar n (read)) (defvar c (apply #'vector (sort (loop repeat n collect (read)) #'<))) (defvar s (loop for i from 0 to (1- (floor n 2)) sum (aref c i))) (defvar b (loop for i from (ceiling n 2) to (1- n) sum (aref c i))) (princ (if (evenp n) (abs (- (abs s) (abs b))) (max (abs (- (abs (+ s (aref c (floor n 2)))) (abs b))) (abs (- (abs (+ b (aref c (floor n 2)))) (abs s)))))) (fresh-line)