Return set of indexes and check duplication.