Source: http://math.mit.edu/~shor/18.310/median.pdf