Thanks. But I exactly wanted what I said. I want 1 and 4 that are the starting positions of the ordered vector g in f. Your code gives this: 1 2 4 5 7 8. These numbers are where each single value of g are placed in f. I want g to be seen as an ordered vector not a set of unordered values.