':type nums: List[int]
:rtype: int'

def findUnsortedSubarray(self, nums):

    n = len(nums)
    (left, right) = ((-1), (-2))
    (min_from_right, max_from_left) = (nums[(-1)], nums[0])
    for i in xrange(1, n):
        max_from_left = max(max_from_left, nums[i])
        min_from_right = min(min_from_right, nums[((n - 1) - i)])
        if (nums[i] < max_from_left):
            right = i
        if (nums[((n - 1) - i)] > min_from_right):
            left = ((n - 1) - i)
    return ((right - left) + 1)
