relationship:
Suppose you want to sort the sequence from smallest to largest.
Bubble sorting exchanges every time it encounters adjacent a[i]>a[i+1]. Obviously, the two numbers exchanged each time must be reversed pairs.
Each exchange means reducing one reversed pair, then the total number of exchanges is the total number of reversed pairs of the sequence.