[Python/C++/C/Go] O(N² )
```Python3 []
def minimumPairRemoval(self, nums):
    res = 0
    while any(a > b for a, b in pairwise(nums)):
        sums = list(map(sum, pairwise(nums)))
        num = min(sums)
        i = sums.index(num)
        nums = nums[:i] + [num] + nums[i + 2 :]
        res += 1
    return res
```
```python3 []
def minimumPairRemoval(self, nums):
    n = len(nums)
    while any(a > b for a, b in pairwise(nums)):
        num, i = min((sum(p), i) for i, p in enumerate(pairwise(nums)))
        nums = nums[:i] + [num] + nums[i + 2 :]
    return n - len(nums)
```
```Python3 []
def minimumPairRemoval(self, nums):
    if all(a <= b for a, b in pairwise(nums)): return 0
    num, i = min((sum(p), i) for i, p in enumerate(pairwise(nums)))
    return self.minimumPairRemoval(nums[:i] + [num] + nums[i + 2 :]) + 1
```
```C++ []
int minimumPairRemoval(vector<int>& nums) {
    int res;
    for (res = 0; !is_sorted(nums.begin(), nums.end()); ++res) {
        int tot = 50001, cur, j;
        for (int i = 0; i < nums.size() - 1; ++i)
            if ((cur = nums[i] + nums[i + 1]) < tot) tot = cur, j = i;
        nums[j] = tot;
        for (int i = j + 1; i < nums.size() - 1; ++i) nums[i] = nums[i + 1];
        nums.pop_back();
    }
    return res;
}
```
```C []
int minimumPairRemoval(int* nums, int numsSize) {
    bool isSorted(int* nums, int n) {
        for (--n; n; --n)
            if (nums[n - 1] > nums[n]) return false;
        return true;
    }
    int res;
    for (res = 0; !isSorted(nums, numsSize); --numsSize, ++res) {
        int tot = 50001, cur, j;
        for (int i = 0; i < numsSize - 1; ++i)
            if ((cur = nums[i] + nums[i + 1]) < tot) tot = cur, j = i;
        nums[j] = tot;
        for (int i = j + 1; i < numsSize - 1; ++i) nums[i] = nums[i + 1];
    }
    return res;
}
```
```Go []
func minimumPairRemoval(nums []int) int {
	var res int
	for res = 0; !sort.SliceIsSorted(nums, func(i, j int) bool { return nums[i] < nums[j] }); res++ {
		var (
			tot    = 50001
			cur, j int
		)
		for i := 0; i < len(nums)-1; i++ {
			cur = nums[i] + nums[i+1]
			if cur < tot {
				tot, j = cur, i
			}

		}
		nums[j] = tot
		nums = append(nums[:j+1], nums[j+2:]...)
	}
	return res
}
```
['Simulation']