```
class Solution(object):
def removeDuplicates(self, nums):
if nums == []: return 0
i = 0
for index,value in enumerate(nums):
if value > nums[i]:
i+=1
nums[i],nums[index] = nums[index],nums[i]
return i + 1
```