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 10
At the end of the sorting process, write the number of occurrences of exchange or swap.
= 23 swaps