```
def countSmaller(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
res = []
s = [] #sorted list
for n in nums[::-1]:
i = bisect.bisect_left(s,n)
#find the index, which means how many numbers in the sorted array are smaller than the cur number
res.insert(0,i)
bisect.insort(s,n)
return res
```