import bisect



n=int(eval(input()))

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



t=0

for i in range(n):

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

    a = j+1

    b = bisect.bisect_left(l,l[i]+l[j])

    t += b-a if b>a else 0



print(t)

import bisect



n=int(eval(input()))

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



t=0

for i in range(n):

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

    t += bisect.bisect_left(l,l[i]+l[j]) - j - 1



print(t)

import bisect

n = int(eval(input()))
l = sorted(map(int, input().split()))
t = 0
for i in range(n):
    for j in range(i + 1, n):
        a = j + 1
        b = bisect.bisect_left(l, l[i] + l[j])
        t += b - a if b > a else 0
print(t)

import bisect

n = int(eval(input()))
l = sorted(map(int, input().split()))
t = 0
for i in range(n):
    for j in range(i + 1, n):
        t += bisect.bisect_left(l, l[i] + l[j]) - j - 1
print(t)

-        a = j + 1 -        b = bisect.bisect_left(l, l[i] + l[j]) -        t += b - a if b > a else 0 +        t += bisect.bisect_left(l, l[i] + l[j]) - j - 1