```
int removeDuplicates(int A[], int n) {
int new_size = n;
for(int i = 1; i < n; ++i){
if(A[i - 1] == A[i]){
--new_size;
memmove(&A[i - 1], &A[i], ((n-i)*sizeof(int)));
A[n - 1] = 999 + new_size;
--i;
}
}
return new_size;}
```

Here is my solution in C with memove(). I think it's an O(n ^ 2) solution but I am not sure about how long will memmove() take. It seems that it's very fast. I use no extra space. However, memmove() do need a buffer for moving memory around. Hope you enjoy the solution.