Learnacy Lab
Neighbours swap when out of order; each pass carries the largest unsettled bar to the right, and the swap count equals the inverted pairs.