find median of a vector