```
class Solution:
# @param A a list of integers
# @return an integer
def removeDuplicates(self, A):
if len(A)==0:
return 0
cur=0
point=0
while point<len(A):
if point<len(A)-2 and A[point]==A[point+1] and A[point]==A[point+2]:
point=point+1
else:
A[cur]=A[point]
point=point+1
cur=cur+1
return cur
```

this is essentially the same as problem I.only difference is to check if it has more than 3 duplicates