<>;$x+=abs$_-$_[@_/2]for@_=`tr ' ' '\\n'|sort -nr`;print$x