Proof. For the left inequality, Inv Pn
i=1 di, we con-
sider the following algorithm: If there is an element xi
not at its correct position, move xi to position i, such
that position i temporarily contains both xi and xi in
sorted order. Next move xi to its correct position, and
repeat moving an element from the position temporar-
ily containing two elements to its correct position, until
we move an element to position i. Repeat until the se-
quence is sorted. By moving element xi from position i
to its correct position i, we move xi over the di