Solution in Java
Code

# Code
```java []
class Solution {
    public int minimumRightShifts(List<Integer> nums) {
        int n = nums.size();
        int shift = -1;
        for(int i=0; i<n; i++){
            if(nums.get(i) > nums.get((i+1) % n)){
                if(shift != -1) return -1;
                shift = i+1;
            }
        }

        if(shift == -1) return 0;
        
        for(int i=0; i<n; i++){
            if(nums.get((i+shift) % n) != nums.stream().sorted().toList().get(i))
                return -1;
        }
        return n - shift;
    }
}
```
['Java']