import numpy as np
from numba import njit
 

@njit
def f(a):
    n = len(a)
    cnt = 0
    
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
    return cnt


n = int(input())
a = np.array(input().split(), dtype=np.int32)
a.sort()
print(f(a)) import numpy as np numpy from numba import njit def f(a):
    n = len(a)
    cnt = 0
    
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
    return cnt f n = len(a) n len(a) len a cnt = 0 cnt 0 for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
     i range(n) range n for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
     j range(i + 1, n) range i + 1 i 1 n for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
     k range(j + 1, n) range j + 1 j 1 n if a[k] < a[i] + a[j]:
                    cnt += 1
     a[k] < a[i] + a[j] a[k] a k a[i] + a[j] a[i] a i a[j] a j cnt += 1 cnt 1 return cnt cnt a a @njit f njit f n = int(input()) n int(input()) int input() input a = np.array(input().split(), dtype=np.int32) a np.array(input().split(), dtype=np.int32) np.array np array input().split() ().split () input split dtype=np.int32 dtype np.int32 np int32 a.sort() a.sort a sort print(f(a)) print f(a) f a a = np.array(input().split(), dtype=np.int32) np.array(input().split(), dtype=np.int32) a n = int(input()) int(input()) n def f(a):
    n = len(a)
    cnt = 0
    
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
    return cnt def f(a):
    n = len(a)
    cnt = 0
    
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
    return cnt f
import numpy as np
from numba import njit
 

@njit
def f(a):
    n = len(a)
    cnt = 0
    
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                if a[k] < a[i] + a[j]:
                    cnt += 1
    return cnt


n = int(input())
a = np.array(input().split(), dtype=np.int32)
a.sort()
print(f(a))
