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

import bisect

count = 0
for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left)

print(count) 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 import bisect bisect count = 0 count 0 for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left) i range(n-1) range n-1 n 1 for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left) j range(i+1, n) range i+1 i 1 n ab = l[i] + l[j] ab l[i] + l[j] l[i] l i l[j] l j right = bisect.bisect(l, ab-1) right bisect.bisect(l, ab-1) bisect.bisect bisect bisect l ab-1 ab 1 left = j + 1 left j + 1 j 1 count += (right - left) count right - left right left print(count) print count l = list(map(int, input().split())) list(map(int, input().split())) l right = bisect.bisect(l, ab-1) bisect.bisect(l, ab-1) right left = j + 1 j + 1 left count += (right - left) right - left count ab = l[i] + l[j] l[i] + l[j] ab n = int(input()) int(input()) n count = 0 0 count
n = int(input())
l = list(map(int, input().split()))
l.sort()

import bisect

count = 0
for i in range(n-1):
    for j in range(i+1, n):
            ab = l[i] + l[j]
            right = bisect.bisect(l, ab-1)
            left = j + 1
            count += (right - left)

print(count)