Few lines of Code  C++
Intuition\n Describe your first thoughts on how to solve this problem. \nFind the pivot i.e where monotonicity changes\neg ->   4 5 1 2 3  \nhere pivot is 5 so 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nFind the pivot i.e where monotonicity changes\neg ->   4 5 1 2 3  \nhere pivot is 5 so we need to make 3 shifts to right which is  - - n-indx -1(ans)\n\n\n\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumRightShifts(vector<int>& nums) {\n        int ans=0, cnt=0 ,n=nums.size();\n        if(n==1)return 0;//edge case single number\n        for(int i=0;i<n;i++){\n            if(nums[i]>nums[(i+1)%n]){\n                cnt++;\n                ans=n-i-1;\n            }\n        }\n        return cnt==1 ?ans:-1; // if more than 1 pivot -1 cant sort \n    }\n};\n```
['C++']