remove duplicates using count and del