Sort numbers in ascending or descending order