import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
l = rl()

l.sort()
ans=0
for i in range(n):
    for j in range(i):
        ans+=bisect.bisect_left(l, l[i]+l[j])-(i+1)
print(ans) import sys sys from collections import deque, Counter, defaultdict import bisect bisect import math math input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 inf = 10**18 inf 10**18 10 18 MOD = 1000000007 MOD 1000000007 ri = lambda : int(input()) ri lambda : int(input()) int(input()) int input() input rs = lambda : input().strip() rs lambda : input().strip() input().strip() ().strip () input strip rl = lambda : list(map(int, input().split())) rl lambda : list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split n = ri() n ri() ri l = rl() l rl() rl l.sort() l.sort l sort ans=0 ans 0 for i in range(n):
    for j in range(i):
        ans+=bisect.bisect_left(l, l[i]+l[j])-(i+1) i range(n) range n for j in range(i):
        ans+=bisect.bisect_left(l, l[i]+l[j])-(i+1) j range(i) range i ans+=bisect.bisect_left(l, l[i]+l[j])-(i+1) ans bisect.bisect_left(l, l[i]+l[j])-(i+1) bisect.bisect_left(l, l[i]+l[j]) bisect.bisect_left bisect bisect_left l l[i]+l[j] l[i] l i l[j] l j i+1 i 1 print(ans) print ans ri = lambda : int(input()) lambda : int(input()) ri ans+=bisect.bisect_left(l, l[i]+l[j])-(i+1) bisect.bisect_left(l, l[i]+l[j])-(i+1) ans ans=0 0 ans rs = lambda : input().strip() lambda : input().strip() rs rl = lambda : list(map(int, input().split())) lambda : list(map(int, input().split())) rl n = ri() ri() n inf = 10**18 10**18 inf MOD = 1000000007 1000000007 MOD l = rl() rl() l input = sys.stdin.readline sys.stdin.readline input
import sys
#import time
from collections import deque, Counter, defaultdict
#from fractions import gcd
import bisect
#import heapq
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n = ri()
l = rl()

l.sort()
ans=0
for i in range(n):
    for j in range(i):
        ans+=bisect.bisect_left(l, l[i]+l[j])-(i+1)
print(ans)