Delete duplicates in n time