N = int(input())
L = list(map(int,input().split()))
L = sorted(L)

def binary_search(a,b):
  top = N
  bottom = b
  c = (top + bottom)//2
  while top - bottom > 1:
    #print(a,b,":",top,bottom,c)
    if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
    c = (top + bottom)//2
  return top - 1

cnt = 0
for a in range(N-2):
  for b in range(a+1,N-1):
    cnt += binary_search(a,b) - b

print(cnt) 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 = sorted(L) L sorted(L) sorted L def binary_search(a,b):
  top = N
  bottom = b
  c = (top + bottom)//2
  while top - bottom > 1:
    #print(a,b,":",top,bottom,c)
    if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
    c = (top + bottom)//2
  return top - 1 binary_search top = N top N bottom = b bottom b c = (top + bottom)//2 c (top + bottom)//2 top + bottom top bottom 2 while top - bottom > 1:
    #print(a,b,":",top,bottom,c)
    if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
    c = (top + bottom)//2
   top - bottom > 1 top - bottom top bottom 1 if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
     L[c] < L[a] + L[b] L[c] L c L[a] + L[b] L[a] L a L[b] L b bottom = c bottom c top = c top c c = (top + bottom)//2 c (top + bottom)//2 top + bottom top bottom 2 return top - 1 top - 1 top 1 a a b b cnt = 0 cnt 0 for a in range(N-2):
  for b in range(a+1,N-1):
    cnt += binary_search(a,b) - b a range(N-2) range N-2 N 2 for b in range(a+1,N-1):
    cnt += binary_search(a,b) - b b range(a+1,N-1) range a+1 a 1 N-1 N 1 cnt += binary_search(a,b) - b cnt binary_search(a,b) - b binary_search(a,b) binary_search a b b print(cnt) print cnt cnt += binary_search(a,b) - b binary_search(a,b) - b cnt L = list(map(int,input().split())) list(map(int,input().split())) L L = sorted(L) sorted(L) L N = int(input()) int(input()) N cnt = 0 0 cnt def binary_search(a,b):
  top = N
  bottom = b
  c = (top + bottom)//2
  while top - bottom > 1:
    #print(a,b,":",top,bottom,c)
    if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
    c = (top + bottom)//2
  return top - 1 def binary_search(a,b):
  top = N
  bottom = b
  c = (top + bottom)//2
  while top - bottom > 1:
    #print(a,b,":",top,bottom,c)
    if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
    c = (top + bottom)//2
  return top - 1 binary_search
N = int(input())
L = list(map(int,input().split()))
L = sorted(L)

def binary_search(a,b):
  top = N
  bottom = b
  c = (top + bottom)//2
  while top - bottom > 1:
    #print(a,b,":",top,bottom,c)
    if L[c] < L[a] + L[b]:
      bottom = c
    else:
      top = c
    c = (top + bottom)//2
  return top - 1

cnt = 0
for a in range(N-2):
  for b in range(a+1,N-1):
    cnt += binary_search(a,b) - b

print(cnt)