```
class Solution(object):
def removeDuplicates(self, nums):
counter = 0
prev = None
#keep track of how many you previously removed from List
removed = 0
for n in range(len(nums)):
curr = nums[n-removed]
if prev != curr:
counter = 1
prev = curr
else:
counter += 1
prev = curr
if counter > 2:
removed += 1
nums.remove(curr)
return len(nums)
```