n= int(eval(input()))

l = list(map(int,input().split()))

l.sort()

def ok(a,b,c):

    return a < b+c and b < a+c and c < a+b

ans = 0

for i in range(n):

    for j in range(i+1,n):

        e1 = l[i]

        e2 = l[j]

        top = n

        bot = j

        while top - bot > 1:

            mid = (top+bot)//2

            if ok(l[mid],e1,e2):bot = mid

            else:top  = mid

        

        ans += top-j-1

print(ans)

    

        

        
n = int(eval(input()))

l = list(map(int,input().split()))

l.sort()

ans = 0

def ok(a,b,c):

    return c < a+b

for i in range(n):

    for j in range(i+1,n):

        bot = j

        top = n

        while top-bot > 1:

            mid = (top+bot)//2

            if ok(l[i],l[j],l[mid]):bot = mid

            else:top = mid

        ans += bot - j

print(ans)
n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()


def ok(a, b, c):
    return a < b + c and b < a + c and c < a + b


ans = 0
for i in range(n):
    for j in range(i + 1, n):
        e1 = l[i]
        e2 = l[j]
        top = n
        bot = j
        while top - bot > 1:
            mid = (top + bot) // 2
            if ok(l[mid], e1, e2):
                bot = mid
            else:
                top = mid
        ans += top - j - 1
print(ans)

n = int(eval(input()))
l = list(map(int, input().split()))
l.sort()
ans = 0


def ok(a, b, c):
    return c < a + b


for i in range(n):
    for j in range(i + 1, n):
        bot = j
        top = n
        while top - bot > 1:
            mid = (top + bot) // 2
            if ok(l[i], l[j], l[mid]):
                bot = mid
            else:
                top = mid
        ans += bot - j
print(ans)

+ans = 0 -    return a < b + c and b < a + c and c < a + b +    return c < a + b -ans = 0 -        e1 = l[i] -        e2 = l[j] +        bot = j -        bot = j -            if ok(l[mid], e1, e2): +            if ok(l[i], l[j], l[mid]): -        ans += top - j - 1 +        ans += bot - j