n = int(input())
a = list(map(int, input().split()))
 
a.sort()
count = 0
for i in range(n-1, 0, -1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
 
print(count) n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split a.sort() a.sort a sort count = 0 count 0 for i in range(n-1, 0, -1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
  i range(n-1, 0, -1) range n-1 n 1 0 -1 l = 0 l 0 r = i-1 r i-1 i 1 while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
  l<r l r if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
  a[l] + a[r] > a[i] a[l] + a[r] a[l] a l a[r] a r a[i] a i count += r-l count r-l r l r -= 1 r 1 l += 1 l 1 print(count) print count r -= 1 1 r count = 0 0 count l = 0 0 l count += r-l r-l count n = int(input()) int(input()) n l += 1 1 l r = i-1 i-1 r a = list(map(int, input().split())) list(map(int, input().split())) a
n = int(input())
a = list(map(int, input().split()))
 
a.sort()
count = 0
for i in range(n-1, 0, -1):
    l = 0
    r = i-1
    while(l<r):
        if a[l] + a[r] > a[i]:
            count += r-l
            r -= 1
 
        else:
            l += 1
 
print(count)