```
from collections import Counter
class Solution(object):
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
if nums ==[]: return []
count = Counter(nums)
r = []
nums = count.keys()
n = len(nums)
for i in range(n):
c = count[nums[i]]
new_list = [[nums[i]]*x for x in range(1, c+1)]
copy = r[:]
for l in copy:
for n in new_list:
r += [l + n]
r += new_list
return r + [[]]
```