```
import bisect
class Solution(object):
def reversePairs(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
seen=[]
res=0
for n in nums:
i=bisect.bisect_right(seen,n<<1)
res+=(len(seen)-i)
bisect.insort(seen,n)
return res
```