```
class Solution:
# @param S, a list of integer
# @return a list of lists of integer
def subsets(self, S):
n = len(S);
S = sorted(S)
result = [];
for i in xrange(1<<n):
temp = []
for j in xrange(n):
if i & (1<<j) > 0:
temp.append(S[j]);
result.append(temp);
return result;
```