Starting code to find median