Find the minimum value in an array with sort