n = int(input())
l = list(map(int, input().split()))

s = 0

l.sort()

for i in range(n-2):
    j = n-2
    k = n-1
    while i < j:
        if l[k] >= l[i] + l[j] and j < k:
            #print(0, i, j, k)
            k -= 1
        else:
            #print(1, i, j, k)
            s += k - j
            j -= 1


print(s) 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 s = 0 s 0 l.sort() l.sort l sort for i in range(n-2):
    j = n-2
    k = n-1
    while i < j:
        if l[k] >= l[i] + l[j] and j < k:
            #print(0, i, j, k)
            k -= 1
        else:
            #print(1, i, j, k)
            s += k - j
            j -= 1 i range(n-2) range n-2 n 2 j = n-2 j n-2 n 2 k = n-1 k n-1 n 1 while i < j:
        if l[k] >= l[i] + l[j] and j < k:
            #print(0, i, j, k)
            k -= 1
        else:
            #print(1, i, j, k)
            s += k - j
            j -= 1 i < j i j if l[k] >= l[i] + l[j] and j < k:
            #print(0, i, j, k)
            k -= 1
        else:
            #print(1, i, j, k)
            s += k - j
            j -= 1 l[k] >= l[i] + l[j] and j < k l[k] >= l[i] + l[j] l[k] l k l[i] + l[j] l[i] l i l[j] l j j < k j k k -= 1 k 1 s += k - j s k - j k j j -= 1 j 1 print(s) print s k -= 1 1 k k = n-1 n-1 k s += k - j k - j s n = int(input()) int(input()) n s = 0 0 s l = list(map(int, input().split())) list(map(int, input().split())) l j = n-2 n-2 j j -= 1 1 j
n = int(input())
l = list(map(int, input().split()))

s = 0

l.sort()

for i in range(n-2):
    j = n-2
    k = n-1
    while i < j:
        if l[k] >= l[i] + l[j] and j < k:
            #print(0, i, j, k)
            k -= 1
        else:
            #print(1, i, j, k)
            s += k - j
            j -= 1


print(s)
