```
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
index = 0
length = len(nums)
if length < 2:
return length
for i in range(1,length):
if nums[index] != nums[i]:
index += 1
nums[index] = nums[i]
index += 1
return index
```