inputs are restricted to permutations of $1...n$ with at most $n$ inversions
so if we take input as $n,1,2….n-1,n-2$
here no. of inversions is$ n$
e.g. if n=9
$9,1,2,3,4,5,6,8,7$
inversions are
$(9,1)(9,2)(9,3)(9,4)(9,5)(9,6)(9,8)(9,7)(8,7) i.e. 9$
so worst case input according to question is $n,1,2….n-1,n-2$
this will take O(N) time to sort using insertion sort as except n & n-2 all elements are sorted