```
class Solution(object):
def missingNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
i = 0
while i < n:
cur = nums[i]
if cur == n or cur == i:
i+=1
continue
tmp = nums[cur]
nums[cur] = cur
nums[i] = tmp
i = 0
while i<n:
if i != nums[i]:
return i
i +=1
return n
```