from bisect import *
N = int(input())
L = sorted(map(int,input().split()))
a = 0

for i in range(N):
  for j in range(i+1,N):
    a+=bisect_left(L,L[i]+L[j])-(j+1)
    
print(a) from bisect import * N = int(input()) N int(input()) int input() input L = sorted(map(int,input().split())) L sorted(map(int,input().split())) sorted map(int,input().split()) map int input().split() ().split () input split a = 0 a 0 for i in range(N):
  for j in range(i+1,N):
    a+=bisect_left(L,L[i]+L[j])-(j+1)
     i range(N) range N for j in range(i+1,N):
    a+=bisect_left(L,L[i]+L[j])-(j+1)
     j range(i+1,N) range i+1 i 1 N a+=bisect_left(L,L[i]+L[j])-(j+1) a bisect_left(L,L[i]+L[j])-(j+1) bisect_left(L,L[i]+L[j]) bisect_left L L[i]+L[j] L[i] L i L[j] L j j+1 j 1 print(a) print a a = 0 0 a N = int(input()) int(input()) N a+=bisect_left(L,L[i]+L[j])-(j+1) bisect_left(L,L[i]+L[j])-(j+1) a L = sorted(map(int,input().split())) sorted(map(int,input().split())) L
from bisect import *
N = int(input())
L = sorted(map(int,input().split()))
a = 0

for i in range(N):
  for j in range(i+1,N):
    a+=bisect_left(L,L[i]+L[j])-(j+1)
    
print(a)