N = int(input())
A = [i for i in map(int, input().split())]

def search(arr):
    if len(arr) == 1:
        if arr[0] == 0:
            return arr, 1
        else:
            return arr, 0
    kouho, count = search(arr[1:])
    next_arr = [i + arr[0] for i in kouho]
    next_arr.append(arr[0])
    count += next_arr.count(0)
    return next_arr, count

arr, count = search(A)
print(count)
