N=int(input())
L=list(map(int,input().split()))
sort_L=sorted(L,reverse=True)
ans=0
for n in range(N-2):
    for o in range(n+1,N-1):
        lar=sort_L[n]
        kouho=sort_L[o+1:]
        mid=sort_L[o]
        sa=lar-mid
        left=0
        right=N-o-2
        if kouho[-1]>sa:
            ans+=right+1
        else:
            while right > left + 1:
                half = (right + left) // 2
                if kouho[half] <= sa:
                    right = half
                else:
                    left = half
            if kouho[right]<=sa and kouho[left]<=sa:
                continue
            elif kouho[right]>sa:
                ans+=right+1
            else:
                ans+=left+1
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 sort_L=sorted(L,reverse=True) sort_L sorted(L,reverse=True) sorted L reverse=True reverse True ans=0 ans 0 for n in range(N-2):
    for o in range(n+1,N-1):
        lar=sort_L[n]
        kouho=sort_L[o+1:]
        mid=sort_L[o]
        sa=lar-mid
        left=0
        right=N-o-2
        if kouho[-1]>sa:
            ans+=right+1
        else:
            while right > left + 1:
                half = (right + left) // 2
                if kouho[half] <= sa:
                    right = half
                else:
                    left = half
            if kouho[right]<=sa and kouho[left]<=sa:
                continue
            elif kouho[right]>sa:
                ans+=right+1
            else:
                ans+=left+1 n range(N-2) range N-2 N 2 for o in range(n+1,N-1):
        lar=sort_L[n]
        kouho=sort_L[o+1:]
        mid=sort_L[o]
        sa=lar-mid
        left=0
        right=N-o-2
        if kouho[-1]>sa:
            ans+=right+1
        else:
            while right > left + 1:
                half = (right + left) // 2
                if kouho[half] <= sa:
                    right = half
                else:
                    left = half
            if kouho[right]<=sa and kouho[left]<=sa:
                continue
            elif kouho[right]>sa:
                ans+=right+1
            else:
                ans+=left+1 o range(n+1,N-1) range n+1 n 1 N-1 N 1 lar=sort_L[n] lar sort_L[n] sort_L n kouho=sort_L[o+1:] kouho sort_L[o+1:] sort_L o+1: o+1 o 1 mid=sort_L[o] mid sort_L[o] sort_L o sa=lar-mid sa lar-mid lar mid left=0 left 0 right=N-o-2 right N-o-2 N-o N o 2 if kouho[-1]>sa:
            ans+=right+1
        else:
            while right > left + 1:
                half = (right + left) // 2
                if kouho[half] <= sa:
                    right = half
                else:
                    left = half
            if kouho[right]<=sa and kouho[left]<=sa:
                continue
            elif kouho[right]>sa:
                ans+=right+1
            else:
                ans+=left+1 kouho[-1]>sa kouho[-1] kouho -1 sa ans+=right+1 ans right+1 right 1 while right > left + 1:
                half = (right + left) // 2
                if kouho[half] <= sa:
                    right = half
                else:
                    left = half
             right > left + 1 right left + 1 left 1 half = (right + left) // 2 half (right + left) // 2 right + left right left 2 if kouho[half] <= sa:
                    right = half
                else:
                    left = half
             kouho[half] <= sa kouho[half] kouho half sa right = half right half left = half left half if kouho[right]<=sa and kouho[left]<=sa:
                continue
            elif kouho[right]>sa:
                ans+=right+1
            else:
                ans+=left+1 kouho[right]<=sa and kouho[left]<=sa kouho[right]<=sa kouho[right] kouho right sa kouho[left]<=sa kouho[left] kouho left sa continue elif kouho[right]>sa:
                ans+=right+1
             kouho[right]>sa kouho[right] kouho right sa ans+=right+1 ans right+1 right 1 ans+=left+1 ans left+1 left 1 print(ans) print ans L=list(map(int,input().split())) list(map(int,input().split())) L ans+=right+1 right+1 ans ans+=left+1 left+1 ans sa=lar-mid lar-mid sa right = half half right left = half half left N=int(input()) int(input()) N lar=sort_L[n] sort_L[n] lar half = (right + left) // 2 (right + left) // 2 half left=0 0 left ans+=right+1 right+1 ans ans=0 0 ans sort_L=sorted(L,reverse=True) sorted(L,reverse=True) sort_L right=N-o-2 N-o-2 right kouho=sort_L[o+1:] sort_L[o+1:] kouho mid=sort_L[o] sort_L[o] mid
N=int(input())
L=list(map(int,input().split()))
sort_L=sorted(L,reverse=True)
ans=0
for n in range(N-2):
    for o in range(n+1,N-1):
        lar=sort_L[n]
        kouho=sort_L[o+1:]
        mid=sort_L[o]
        sa=lar-mid
        left=0
        right=N-o-2
        if kouho[-1]>sa:
            ans+=right+1
        else:
            while right > left + 1:
                half = (right + left) // 2
                if kouho[half] <= sa:
                    right = half
                else:
                    left = half
            if kouho[right]<=sa and kouho[left]<=sa:
                continue
            elif kouho[right]>sa:
                ans+=right+1
            else:
                ans+=left+1
print(ans)
