Given a permutation (a1,a1,...,an) of the numbers 1,2,...,n one may interchange any two consecutive "blocks" - that is, one may transform
(a1,a2,...,ai,Aai+1,...ai+p,Bai+p+1,...,ai+q,...,an)
into
(a1,a2,...,ai,Bai+p+1,...,ai+q,Aai+1,...ai+p,...,an)
by interchanging the "blocks" A and B. Find the least number of such changes which are needed to transform (n,n−1,...,1) into (1,2,...,n)