array has duplicates function