https://youtu.be/KFcodn4qfrQ
please check this video for the method used by others to solve the question (linearity of expectation) MIT video
just think it as expected no. of heads in n coin flips.
here n coin flips refers to no. of pairs in the sequence which is n©2. probability of head = probability of a pair being a inversion=0.5
remember expectation of a binomial distribution is np, here also same.
expectation of no. of inversion pairs =np=n©2*0.5