```
class Solution:
# @param a list of integers
# @return an integer
def removeDuplicates(self, A):
if len(A) == 0:
return 0
temp = A[0]
n = 1
for num in A[1:]:
if num != temp:
temp = num
A[n] = num
n += 1
A = A[:n]
return n
```