class Solution

{

public:

```
int removeDuplicates(int A[], int n)
{
int len = n;
for (int i = 1; i < len; i++)
{
while (A[i-1] == A[i])
{
for (int j = i; j < len;j++)
A[j-1] = A[j];
len--;
if (len < 2)
break;
}
}
return len;
}
```

};