```
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if not nums:
return 0
count=len(nums)
i=1
while i<count:
if(nums[i]==nums[i-1]):
nums.pop(i);
i-=1
count-=1
i+=1
return count
```