------
## 最终结论
```python
def minOperations(target):
    operations = 0
    for i in range(len(target)):
        if i == 0:
            operations += target[i]  # First element, just add its value
        else:
            operations += max(0, target[i] - target[i - 1])  # Only add the positive difference
    return operations

# Example usage:
print(minOperations([1,2,3,2,1]))  # Output: 3
print(minOperations([3,1,1,2]))    # Output: 4
print(minOperations([3,1,5,4,2]))  # Output: 7
print(minOperations([1,1,1,1]))    # Output: 1
```