Solution in C
Code
# Code
```c []
int minimumRightShifts(int* nums, int numsSize) {
    int count = 0, index;
    for (int i = 0; i < numsSize - 1; i++) {
        if (nums[i] > nums[i + 1]) {
            count++;
            index = i + 1;
        }
    }
    if (nums[numsSize - 1] > nums[0] && count != 0)
        count++; // compare last element with first element-if count!=0
    if (count > 1)
        return -1; // cannot be sorted
    if (count == 0)
        return 0; // already sorted
    return numsSize - index;
}
```
['C']