def ma(li):
if not li:
return li
n = len(li)
m = []
for i in range(n-1):
nn = 0
for j in range(i+1, n-1):
if li[i] < li[j]:
nn += 1
m.append(nn)
print(m)

l = [1,3,6,5,3,2,1,5,7,9,5]
ma(l)