Swap
sort it. then find out your number was destiny.
adjacent-swap sort — your count vs the true minimum
However you go about sorting the bars, there’s a fixed minimum number of adjacent swaps required to put them in order — and that number is fixed by the starting scramble itself, before a single swap happens. Your count measures how close you came to that unavoidable minimum, not how hard the puzzle actually was.
Concepts: sorting, algorithms.
An interactive you play with one thumb, on Wundr.