```
int removeDuplicates(int* nums, int numsSize) {
if(numsSize==0)
return 0;
int now=nums[0];
int sum=1;
for(int i=1;i<numsSize;i++)
{
if(nums[i]!=now)
{
now=nums[i];
nums[sum]=now;
sum++;
}
}
return sum;
}
```