I usually do it by sorting the list and then scanning in the obvious way, moving stuff down, and doing a single del operation at the end.