Since this was apparently a little confusing, suppose that the cycle lengths of S are
a_
1 <= a_
2 <= a_
3 <= ..... <= a_
r.
Here I omit the 1-cycle lengths, so a_
1 > 1, and sum a_
r = m for some m possibly less than n. Then the cycle lengths of the steps in the algorithm will have lengths:
(a_
1, ...., a_
(r-1),a_
r),
(a_
1, ...., a_
(r-2),a_
(r-1) + a_
r),
(a_
1, ...., a_
(r-3),a_
(r-2) + a_
(r-1) + a_
r),
....
(a_
1 + a_
_2 + ... + a_
r) = (m)
(2,m)
(m+2)
(2,m+2)
(m+4)
...
(n-1 or n, depending on m mod 2),
then n-1.