Python Easy Solution
Code\n\nclass Solution:\n    def semiOrderedPermutation(self, nums: List[int]) -> int:\n        a=nums.index(min(nums))\n        b=nums.index(max(nums))\n      
# Code\n```\nclass Solution:\n    def semiOrderedPermutation(self, nums: List[int]) -> int:\n        a=nums.index(min(nums))\n        b=nums.index(max(nums))\n        if b<a:\n            return a+(len(nums)-1-b)-1\n        else:\n            return a+(len(nums)-1-b)\n        \n```
['Python3']