my idea is straight forward,just compare the array with sorted array,the mark the start and the end of the index

```
class Solution(object):
def findUnsortedSubarray(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n=len(nums)
snum=sorted(nums)
start=-1
end=-1
for i in xrange(n):
if not (nums[i] == snum[i]) and (start <0):
start=i
if not (nums[n-i-1] == snum[n-i-1]) and (end <0):
end=n-i
return end - start
```