'''

class Solution(object):

def singleNonDuplicate(self, nums):

"""

:type nums: List[int]

:rtype: int

"""

if len(nums) == 1:

return nums[0]

left, right = 0, len(nums) - 1

while left < right:

mid = (left + right) / 2

if nums[mid] == nums[mid + 1]:

mid -= 1

if (mid - left + 1) % 2 == 1:

right = mid

else:

left = mid + 1

return nums[left]

'''