def combinations(iterable, r):
pool = tuple(iterable)
n = len(pool)
if r > n:
return
indices = list(range(r))
yield tuple(pool[i] for i in indices)
while True:
for i in reversed(range(r)):
if indices[i] != i + n - r:
break
else:
return
indices[i] += 1
for j in range(i+1, r):
indices[j] = indices[j-1] + 1
yield tuple(pool[i] for i in indices)
def sums(array: list) -> int:
combs = []
for i in range(2, len(array)+1):
combs += list(combinations(array, i))
sumsSet = set([0] + array + list(map(sum, combs)))
return len(sumsSet)
print(sums([49, 100, 98, 49, 0]))