import bisect

N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
        
print(counter) import bisect bisect N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i numbers = [int(i) for i in input().split()] numbers [int(i) for i in input().split()] numbers = sorted(numbers) numbers sorted(numbers) sorted numbers counter = 0 counter 0 for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
         a range(N) range N for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
         b range(a+1, N) range a+1 a 1 N c = bisect.bisect_left(numbers, numbers[a] + numbers[b]) c bisect.bisect_left(numbers, numbers[a] + numbers[b]) bisect.bisect_left bisect bisect_left numbers numbers[a] + numbers[b] numbers[a] numbers a numbers[b] numbers b if c > b:
            counter += c - b -1
         c > b c b counter += c - b -1 counter c - b -1 c - b c b 1 print(counter) print counter N = int(input()) int(input()) N counter += c - b -1 c - b -1 counter counter = 0 0 counter c = bisect.bisect_left(numbers, numbers[a] + numbers[b]) bisect.bisect_left(numbers, numbers[a] + numbers[b]) c numbers = [int(i) for i in input().split()] [int(i) for i in input().split()] numbers numbers = sorted(numbers) sorted(numbers) numbers
import bisect

N = int(input())
numbers = [int(i) for i in input().split()]
numbers = sorted(numbers)
counter = 0

for a in range(N):
    for b in range(a+1, N):
        c = bisect.bisect_left(numbers, numbers[a] + numbers[b])
        if c > b:
            counter += c - b -1
        
print(counter)