Equal values must not count.
transcript
Take the list five, five, five. How many pairs are out of order?
An inversion needs a larger earlier value. These values are all equal. So the right answer is zero.
One merge takes the right value on a tie. Each right value then passes the equal values. It counts three. That is wrong.
Take the left value on a tie. No value ever passes an equal one. Each merge step moves the left value out first. Then the equal right value follows it. The count stays zero. That matches the definition of an inversion.
Equal records also keep their order. That is called a stable sort. One rule fixes the count and the order. Later lessons need stable sorting for records.
Test a list of equal values every time you write a merge. It is a small test, and it catches this bug at once. The right count is zero. The wrong merge says three.
On a tie, take the left. Full breakdown in the lecture.