N = int(input())
L = list(map(int, input().split()))
L.sort()
def find(arr, x):
  if arr[0] >= x:
    return 0
  if arr[-1] < x:
    return len(arr)
  
  l = 0
  h = len(arr)
  
  while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
  return h

ans = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    x = L[i] + L[j]
    temp = find(L[j+1:], x)
    ans += temp
print(ans) 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 def find(arr, x):
  if arr[0] >= x:
    return 0
  if arr[-1] < x:
    return len(arr)
  
  l = 0
  h = len(arr)
  
  while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
  return h find if arr[0] >= x:
    return 0
   arr[0] >= x arr[0] arr 0 x return 0 0 if arr[-1] < x:
    return len(arr)
  
   arr[-1] < x arr[-1] arr -1 x return len(arr) len(arr) len arr l = 0 l 0 h = len(arr) h len(arr) len arr while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
   h - l > 1 h - l h l 1 m = (l+h) // 2 m (l+h) // 2 l+h l h 2 if arr[m] < x:
      l = m
    else:
      h = m
   arr[m] < x arr[m] arr m x l = m l m h = m h m return h h arr arr x x ans = 0 ans 0 for i in range(N-2):
  for j in range(i+1, N-1):
    x = L[i] + L[j]
    temp = find(L[j+1:], x)
    ans += temp i range(N-2) range N-2 N 2 for j in range(i+1, N-1):
    x = L[i] + L[j]
    temp = find(L[j+1:], x)
    ans += temp j range(i+1, N-1) range i+1 i 1 N-1 N 1 x = L[i] + L[j] x L[i] + L[j] L[i] L i L[j] L j temp = find(L[j+1:], x) temp find(L[j+1:], x) find L[j+1:] L j+1: j+1 j 1 x ans += temp ans temp print(ans) print ans L = list(map(int, input().split())) list(map(int, input().split())) L temp = find(L[j+1:], x) find(L[j+1:], x) temp N = int(input()) int(input()) N def find(arr, x):
  if arr[0] >= x:
    return 0
  if arr[-1] < x:
    return len(arr)
  
  l = 0
  h = len(arr)
  
  while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
  return h def find(arr, x):
  if arr[0] >= x:
    return 0
  if arr[-1] < x:
    return len(arr)
  
  l = 0
  h = len(arr)
  
  while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
  return h find ans += temp temp ans x = L[i] + L[j] L[i] + L[j] x ans = 0 0 ans
N = int(input())
L = list(map(int, input().split()))
L.sort()
def find(arr, x):
  if arr[0] >= x:
    return 0
  if arr[-1] < x:
    return len(arr)
  
  l = 0
  h = len(arr)
  
  while h - l > 1:
    m = (l+h) // 2
    if arr[m] < x:
      l = m
    else:
      h = m
  return h

ans = 0

for i in range(N-2):
  for j in range(i+1, N-1):
    x = L[i] + L[j]
    temp = find(L[j+1:], x)
    ans += temp
print(ans)