from itertools import groupby
a = [1, 2, 3, 3, 3, 4, 5, 6, 6, 6, 6, 3, 3]
clean = []
trash = 0
for number, values in groupby(a):
values = list(values)
if len(values) < 3:
clean.extend(values)
else:
trash += 1
print(f'ignore {number}: values {values}')
print(clean, trash)