total 35 shifting
First 1 is inserted in a[0]
then 1 shifted to a[1] and 2 get place at a[0]
next, 3 comes a[1] shifts 1 more , and 2 shifts 1 place and a[0] occupied by 3
like that upto 5 insertion there are of shift 4+3+2+1=10
Next 6 inserted at a[2]
So, 1 shifts one place , 2 shifts 1 place, 3 shifts 1 place and 6 occupies a[2]
again 7 inserted 1,2,3,6 shifts 1 place
like that here 1,2,3 shifts 5 place each
and 6,7,8,9 shifts 4,3,2,1 place
So, here total shifts 5+5+5+4+3+2+1=25
total 35 shifting