Cheapest way to send people to two cities

costs is a list of (cost_a, cost_b) for 2n people: what it costs to send each to city A or city B. Exactly n must go to each. Write min_total(costs) that returns the smallest total cost.

min_total([(10, 20), (30, 200), (400, 50), (30, 20)])  ->  110
min_total([(5, 1), (1, 5)])                            ->  2

The point is to practise a greedy on the difference: send everyone to A, then switch the n people for whom switching to B saves the most.

def min_total(costs):
    ...