Deleting Duplicate Instances in Revit

Hey, i am working on a dynamo code where it finds and deletes the duplicate instances from an error message.
This is the code, but here is the issue: If there are 4 same instances on the same place, it just deletes one of them and keeps the other 3. To reduce the number to 1 instance, i need to run it multiple times. Could someone help me to fix this issue, please?
I appreciate all feedbacks, thank you.
P.S: Revit version is 2026.

iirc Lists.DuplicateItemIndices gives you lists of index of duplicates, like[ [0,3,4], [5,9,12] ]. then you List.Map with List.RestOfItems to get [3, 4], [9, 12] excluding 0 and 5. And then List.GetItemAtIndex to obtain the elements and remove them.

and be careful with this kind of location comparison, floating point precision can lead to false positive.