# Arup Guha
# 3/6/2021
# Solution to 2020 SER Problem: Triangular Collection

# Read in the list.
n = int(input(""))
vals = []
for i in range(n):
    vals.append(int(input("")))

# Sort it
vals.sort()

res = 0

# Pick two smalles values.
for i in range(n):
    for j in range(i+1,n):

        # Just set k to the largest index it could be.
        k = j+1
        while k < n and vals[i]+vals[j] > vals[k]:
            k += 1
        k -= 1

        # These are the items we can select any subset from except the empty one.
        numitems = k - j

        # Add in all of these choices for subsets with smallest items
        # vals[i], vals[j].
        res += ((1<<numitems)-1)

# Ta da!
print(res)
