------
## 最终结论
```python
def minMoves2(nums):
    nums.sort()
    median = nums[len(nums) // 2]
    moves = sum(abs(num - median) for num in nums)
    return moves

# Example usage:
print(minMoves2([1, 2, 3]))  # Output: 2
```