Based on the idea that add 1 to n-1 number is same as subtract 1 from one number. And try to make all number equal to the minimum in the list.

```
class Solution {
public:
int minMoves(vector<int>& nums) {
if (nums.empty()) return 0;
int min = nums[0];
long sum = 0;
for (auto& i : nums) {
min = std::min(min, i);
sum += i;
}
return sum - nums.size() * min;
}
};
```