Duplicate elements in an array