n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
c = n - 1
for a in range(n - 2):
    c = n - 1
    for b in range(a + 1, n - 1):
        #　各a,bに対してのcを尺取法で探索
        while l[a] >= l[b] + l[c]:
            c -= 1
            if c <= b:
                break
        else:
            # print(l[a], l[b], l[c])
            ans += c - b
            continue
        break
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 c = n - 1 c n - 1 n 1 for a in range(n - 2):
    c = n - 1
    for b in range(a + 1, n - 1):
        #　各a,bに対してのcを尺取法で探索
        while l[a] >= l[b] + l[c]:
            c -= 1
            if c <= b:
                break
        else:
            # print(l[a], l[b], l[c])
            ans += c - b
            continue
        break a range(n - 2) range n - 2 n 2 c = n - 1 c n - 1 n 1 for b in range(a + 1, n - 1):
        #　各a,bに対してのcを尺取法で探索
        while l[a] >= l[b] + l[c]:
            c -= 1
            if c <= b:
                break
        else:
            # print(l[a], l[b], l[c])
            ans += c - b
            continue
        break b range(a + 1, n - 1) range a + 1 a 1 n - 1 n 1 while l[a] >= l[b] + l[c]:
            c -= 1
            if c <= b:
                break
        else:
            # print(l[a], l[b], l[c])
            ans += c - b
            continue
         l[a] >= l[b] + l[c] l[a] l a l[b] + l[c] l[b] l b l[c] l c c -= 1 c 1 if c <= b:
                break
         c <= b c b break ans += c - b ans c - b c b continue break print(ans) print ans c = n - 1 n - 1 c c -= 1 1 c ans = 0 0 ans c = n - 1 n - 1 c n = int(input()) int(input()) n ans += c - b c - b ans l = list(map(int, input().split())) list(map(int, input().split())) l
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
ans = 0
c = n - 1
for a in range(n - 2):
    c = n - 1
    for b in range(a + 1, n - 1):
        #　各a,bに対してのcを尺取法で探索
        while l[a] >= l[b] + l[c]:
            c -= 1
            if c <= b:
                break
        else:
            # print(l[a], l[b], l[c])
            ans += c - b
            continue
        break
print(ans)