Simple Python Solution
Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n\nclass Solution:\n    def minimumRightShifts(self, nums: List[int]) -> int:\n       
# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution:\n    def minimumRightShifts(self, nums: List[int]) -> int:\n        j = None\n        count = 0\n        for i in range(len(nums)-1):\n            if nums[i] > nums[i+1]:\n                count += 1\n                j = i\n        if j is None:\n            return 0\n        if count > 1 or nums[j] < nums[-1]:\n            return -1\n        return len(nums) - j - 1\n```
['Python3']