Number of errors (the easiest one pass solution)
Intuition\n Describe your first thoughts on how to solve this problem. \nLet\'s find out how many times the sequence is broken.\nThis problem is similar to 1752
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nLet\'s find out how many times the sequence is broken.\nThis problem is similar to [1752. Check if Array Is Sorted and Rotated](https://leetcode.com/problems/check-if-array-is-sorted-and-rotated/description/).\n# Approach\n<!-- Describe your approach to solving the problem. -->\nIf the previous element is greater than the next one more than once, the answer is `-1`.\n# Complexity\n- Time complexity: $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n---\n* You could find some other extraordinary solutions in my [profile](https://leetcode.com/almostmonday/) on the Solutions tab (I don\'t post obvious or not interesting solutions at all.)\n* If this was helpful, please upvote so that others can see this solution too.\n---\n\n# Code\n```\nclass Solution:\n    def minimumRightShifts(self, nums: List[int]) -> int:\n        res = len(nums) * (nums[-1] >= nums[0])\n        for i in range(1, len(nums)):\n            if nums[i] < nums[i - 1]:\n                if res: return -1\n                else: res = i\n\n        return len(nums) - res\n```
['Array', 'Greedy', 'Python', 'Python3']