Simple [C] Solution 9 Lines
Code
# Code
```c []
int minimumRightShifts(int* nums, int n) {
    int i = 0;
    while (++i < n)
        if (nums[i] < nums[i - 1]) break;
    int ans = n - i;
    if (ans == 0) return 0;
    if (nums[n - 1] > nums[0]) return -1;
    while (++i < n)
        if (nums[i] < nums[i - 1]) return -1;
    return ans;
}
```
['C']