Gauche solution for small a

It is gauche because there must be a better way that what I
used to solve the following:
given a list of integers, if we are to change all the integers
to a fixed integer n, what n should we choose to minimize
the sum of the abs. value between n and each integer?
Brute force solution - works on small, but will definitely fail for large