------
## 最终结论
```python
def min_operations(n):
    # Calculate the median value which is the target value when all elements are equal
    median = (n - 1)

    # Calculate the minimum operations needed by summing up differences to the median
    operations = 0
    for i in range(n // 2):
        operations += median - ((2 * i) + 1)
    
    return operations

# Example usage:
print(min_operations(3))  # Output: 2
print(min_operations(6))  # Output: 9
```