1,1,2,2,2,6,6,6,7,7,7,7,7,7,7,8,8,9,9,9

Example:

Input = 1 Output=0 (First index of 1).

Input = 2 Output=2 (First index of 2).

Input = 6 Output= 5 (First index of 6).

Input = 7 Output= 8 (First index of 7).

Input = 8 Output=15 (First index of 8).

Input = 9 Output=17 (First index of 9).