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

def binary_search(func, array, left=0):
    right=len(array)-1
    y_left, y_right = func(array[left]), func(array[right])
    if y_left==False:return 0
    while True:
        middle = (left+right)//2
        y_middle = func(array[middle])
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

    return left

SUM = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    l = L[i]+L[j]
    if L[-1]<l:
      k = N-1
    else:
      k = binary_search(lambda x: x<l, L, j+1)
    SUM += max(0,k-j)

print(SUM) 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(func, array, left=0):
    right=len(array)-1
    y_left, y_right = func(array[left]), func(array[right])
    if y_left==False:return 0
    while True:
        middle = (left+right)//2
        y_middle = func(array[middle])
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

    return left binary_search right=len(array)-1 right len(array)-1 len(array) len array 1 y_left, y_right = func(array[left]), func(array[right]) y_left func(array[left]) func array[left] array left y_right func(array[right]) func array[right] array right if y_left==False:return 0
     y_left==False y_left False while True:
        middle = (left+right)//2
        y_middle = func(array[middle])
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

     True middle = (left+right)//2 middle (left+right)//2 left+right left right 2 y_middle = func(array[middle]) y_middle func(array[middle]) func array[middle] array middle if y_left==y_middle: left=middle
        else: right=middle
         y_left==y_middle y_left y_middle if right-left==1:break

     right-left==1 right-left right left 1 return left left func func array array left=0 left 0 SUM = 0 SUM 0 for i in range(N-2):
  for j in range(i+1,N-1):
    l = L[i]+L[j]
    if L[-1]<l:
      k = N-1
    else:
      k = binary_search(lambda x: x<l, L, j+1)
    SUM += max(0,k-j) i range(N-2) range N-2 N 2 for j in range(i+1,N-1):
    l = L[i]+L[j]
    if L[-1]<l:
      k = N-1
    else:
      k = binary_search(lambda x: x<l, L, j+1)
    SUM += max(0,k-j) j range(i+1,N-1) range i+1 i 1 N-1 N 1 l = L[i]+L[j] l L[i]+L[j] L[i] L i L[j] L j if L[-1]<l:
      k = N-1
    else:
      k = binary_search(lambda x: x<l, L, j+1)
     L[-1]<l L[-1] L -1 l k = N-1 k N-1 N 1 k = binary_search(lambda x: x<l, L, j+1) k binary_search(lambda x: x<l, L, j+1) binary_search lambda x: x<l x<l x l x L j+1 j 1 SUM += max(0,k-j) SUM max(0,k-j) max 0 k-j k j print(SUM) print SUM SUM += max(0,k-j) max(0,k-j) SUM l = L[i]+L[j] L[i]+L[j] l L=list(map(int,input().split())) list(map(int,input().split())) L SUM = 0 0 SUM N=int(input()) int(input()) N k = N-1 N-1 k L = sorted(L) sorted(L) L k = binary_search(lambda x: x<l, L, j+1) binary_search(lambda x: x<l, L, j+1) k def binary_search(func, array, left=0):
    right=len(array)-1
    y_left, y_right = func(array[left]), func(array[right])
    if y_left==False:return 0
    while True:
        middle = (left+right)//2
        y_middle = func(array[middle])
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

    return left def binary_search(func, array, left=0):
    right=len(array)-1
    y_left, y_right = func(array[left]), func(array[right])
    if y_left==False:return 0
    while True:
        middle = (left+right)//2
        y_middle = func(array[middle])
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

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

def binary_search(func, array, left=0):
    right=len(array)-1
    y_left, y_right = func(array[left]), func(array[right])
    if y_left==False:return 0
    while True:
        middle = (left+right)//2
        y_middle = func(array[middle])
        if y_left==y_middle: left=middle
        else: right=middle
        if right-left==1:break

    return left

SUM = 0
for i in range(N-2):
  for j in range(i+1,N-1):
    l = L[i]+L[j]
    if L[-1]<l:
      k = N-1
    else:
      k = binary_search(lambda x: x<l, L, j+1)
    SUM += max(0,k-j)

print(SUM)