# Task
 Given a sorted array of integers `A`, find such an integer x that the value of `abs(A[0] - x) + abs(A[1] - x) + ... + abs(A[A.length - 1] - x)`
is the smallest possible (here abs denotes the `absolute value`).

 If there are several possible answers, output the smallest one.

# Example

 For `A = [2, 4, 7]`, the output should be `4`.

# Input/Output


 - `[input]` integer array `A`

    A non-empty array of integers, sorted in ascending order.

    Constraints:

    `1 ≤ A.length ≤ 200,`

    `-1000000 ≤ A[i] ≤ 1000000.`


 - `[output]` an integer

Source: codewars | Difficulty: EASY
Tags: Ad-hoc

Starter code: def absolute_values_sum_minimization(A):
	

Solutions:
from statistics import median_low as absolute_values_sum_minimization


def absolute_values_sum_minimization(A):
	d = {x: sum((abs(n - x) for n in A)) for x in A}
	return min(d, key=lambda x: (d[x], x))


import numpy as np

def absolute_values_sum_minimization(A):
	return np.median(A) if len(A) % 2 else A[len(A) // 2 - 1]


def absolute_values_sum_minimization(A):
	return A[(len(A) - 1) // 2]


absolute_values_sum_minimization = lambda li: min([[sum([abs(j - k) for k in li]), j] for (i, j) in enumerate(li)])[1]


absolute_values_sum_minimization = lambda A: A[~len(A) // 2]


def absolute_values_sum_minimization(a):
	return min([x for x in a], key=lambda x: sum([abs(i - x) for i in a]))


def absolute_values_sum_minimization(a):
	return a[len(a) // 2 + len(a) % 2 - 1]


from bisect import *

def absolute_values_sum_minimization(A):
	return min(A, key=lambda r: sum((abs(v - r) for v in A)))


def absolute_values_sum_minimization(A):
	lst = [[sum([abs(j - i) for j in A]), i] for i in A]
	return sorted(lst)[0][-1]