def Insertionsort(A,n):
     # sort A[0], A[1], ..., A[n-1] into ascending order
     if n<=1: return # A is already sorted
     Insertionsort(A,n-1)
     t = A[n-1];
     i = n-2
     while i>=0 and A[i]>t:
            A[i+1] = A[i]
            i -= 1
     A[i+1] = t

A = [10,1,5,4,2,9,8,3,6,7]
Insertionsort(A,10)
print(A)
