Track out of order idx
IntuitionValid Right ship array:
All in order (minIdx == -1);
Only one out of order and Arr[last] < Arr[0];
ApproachComplexity
Time complexity:

Space complexit
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Valid Right ship array:
1. All in order (minIdx == -1);
2. Only one out of order and Arr[last] < Arr[0];

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```csharp []
public class Solution {
    public int MinimumRightShifts(IList<int> nums) {
        int len = nums.Count, minIdx = -1;
        for(int i = 1; i < len; i++)
        {
            if(nums[i] < nums[i-1])
            {
                int nextId = (i+1)%len;
                if(nums[i-1] < nums[nextId] || minIdx > 0)
                    return -1;

                minIdx = i;
            }
        }

        return minIdx == -1 ? 0 : (nums[len-1] < nums[0] ? len-minIdx : -1);
    }
}
```
['C#']