import bisect
N = int(input())
List = list(map(int,input().split()))
List.sort()
ans = 0
for i in range(N-1):
  for j in range(i+1, N):
    ans += bisect.bisect_left(List,List[i]+List[j])-(j+1)
print(ans) import bisect bisect N = int(input()) N int(input()) int input() input List = list(map(int,input().split())) List list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split List.sort() List.sort List sort ans = 0 ans 0 for i in range(N-1):
  for j in range(i+1, N):
    ans += bisect.bisect_left(List,List[i]+List[j])-(j+1) i range(N-1) range N-1 N 1 for j in range(i+1, N):
    ans += bisect.bisect_left(List,List[i]+List[j])-(j+1) j range(i+1, N) range i+1 i 1 N ans += bisect.bisect_left(List,List[i]+List[j])-(j+1) ans bisect.bisect_left(List,List[i]+List[j])-(j+1) bisect.bisect_left(List,List[i]+List[j]) bisect.bisect_left bisect bisect_left List List[i]+List[j] List[i] List i List[j] List j j+1 j 1 print(ans) print ans N = int(input()) int(input()) N ans = 0 0 ans List = list(map(int,input().split())) list(map(int,input().split())) List ans += bisect.bisect_left(List,List[i]+List[j])-(j+1) bisect.bisect_left(List,List[i]+List[j])-(j+1) ans
import bisect
N = int(input())
List = list(map(int,input().split()))
List.sort()
ans = 0
for i in range(N-1):
  for j in range(i+1, N):
    ans += bisect.bisect_left(List,List[i]+List[j])-(j+1)
print(ans)