Min function.