N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = l[i]+l[j]
        start = j+1
        end = N
        while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
        ans += end-j-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 l.sort() l.sort l sort ans = 0 ans 0 for i in range(N-2):
    for j in range(i+1,N-1):
        s = l[i]+l[j]
        start = j+1
        end = N
        while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
        ans += end-j-1 i range(N-2) range N-2 N 2 for j in range(i+1,N-1):
        s = l[i]+l[j]
        start = j+1
        end = N
        while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
        ans += end-j-1 j range(i+1,N-1) range i+1 i 1 N-1 N 1 s = l[i]+l[j] s l[i]+l[j] l[i] l i l[j] l j start = j+1 start j+1 j 1 end = N end N while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
         start != end start end center = (start + end)//2 center (start + end)//2 start + end start end 2 if s <= l[center]:
                end = center
            else:
                start = center + 1
         s <= l[center] s l[center] l center end = center end center start = center + 1 start center + 1 center 1 ans += end-j-1 ans end-j-1 end-j end j 1 print(ans) print ans end = N N end N = int(input()) int(input()) N ans += end-j-1 end-j-1 ans l = list(map(int,input().split())) list(map(int,input().split())) l start = j+1 j+1 start start = center + 1 center + 1 start s = l[i]+l[j] l[i]+l[j] s end = center center end center = (start + end)//2 (start + end)//2 center ans = 0 0 ans
N = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        s = l[i]+l[j]
        start = j+1
        end = N
        while start != end:
            center = (start + end)//2
            if s <= l[center]:
                end = center
            else:
                start = center + 1
        ans += end-j-1
print(ans)
