n=int(input())
L=list(map(int,input().split()))
L.sort(reverse = True)
ans = 0
for i in range(n):
    for j in range(i+1,n):
        cnt = 0
        start=j+1
        goal=n
        while goal!=start:
            half = (start + goal)//2
            if L[i] < L[j] + L[half]:
                start = half + 1
                cnt = max(half-j,cnt)
            else:
                goal = half
        ans += cnt
print(ans) n=int(input()) n int(input()) int input() input L=list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L.sort(reverse = True) L.sort L sort reverse = True reverse True ans = 0 ans 0 for i in range(n):
    for j in range(i+1,n):
        cnt = 0
        start=j+1
        goal=n
        while goal!=start:
            half = (start + goal)//2
            if L[i] < L[j] + L[half]:
                start = half + 1
                cnt = max(half-j,cnt)
            else:
                goal = half
        ans += cnt i range(n) range n for j in range(i+1,n):
        cnt = 0
        start=j+1
        goal=n
        while goal!=start:
            half = (start + goal)//2
            if L[i] < L[j] + L[half]:
                start = half + 1
                cnt = max(half-j,cnt)
            else:
                goal = half
        ans += cnt j range(i+1,n) range i+1 i 1 n cnt = 0 cnt 0 start=j+1 start j+1 j 1 goal=n goal n while goal!=start:
            half = (start + goal)//2
            if L[i] < L[j] + L[half]:
                start = half + 1
                cnt = max(half-j,cnt)
            else:
                goal = half
         goal!=start goal start half = (start + goal)//2 half (start + goal)//2 start + goal start goal 2 if L[i] < L[j] + L[half]:
                start = half + 1
                cnt = max(half-j,cnt)
            else:
                goal = half
         L[i] < L[j] + L[half] L[i] L i L[j] + L[half] L[j] L j L[half] L half start = half + 1 start half + 1 half 1 cnt = max(half-j,cnt) cnt max(half-j,cnt) max half-j half j cnt goal = half goal half ans += cnt ans cnt print(ans) print ans cnt = 0 0 cnt start = half + 1 half + 1 start ans = 0 0 ans goal=n n goal n=int(input()) int(input()) n half = (start + goal)//2 (start + goal)//2 half cnt = max(half-j,cnt) max(half-j,cnt) cnt ans += cnt cnt ans goal = half half goal L=list(map(int,input().split())) list(map(int,input().split())) L start=j+1 j+1 start
n=int(input())
L=list(map(int,input().split()))
L.sort(reverse = True)
ans = 0
for i in range(n):
    for j in range(i+1,n):
        cnt = 0
        start=j+1
        goal=n
        while goal!=start:
            half = (start + goal)//2
            if L[i] < L[j] + L[half]:
                start = half + 1
                cnt = max(half-j,cnt)
            else:
                goal = half
        ans += cnt
print(ans)