#描述#
逆序数定义如下:在序列S中,若i<j但A[i]>A[j],则称A[i]与A[j]为S中的一对逆序数。
#格式#
##输入格式##
第一行给定整数N(2≤N≤50),下一行N个整数(没有重复,N=0时为输入结束)。
##输出格式##
输出每组序列的逆序数对。
#样例1#
##样例输入1##
3
1 2 3
3
3 2 1
3
1 3 2
0
##样例输出1##
0
3
1
#限制#
1000ms
32768KB
#提示#
#来源#
By signing up a OPS universal account, you can submit code and join discussions in all online judging services provided by us.