class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
 
    def to_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= (i & -i)
        return s
 
    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
    def get(self, i, j):
        return self.to_sum(j)-self.to_sum(i-1)



N = int(input())
A = list(map(int,input().split()))
A.sort()
M = pow(10,6)+ 100
Tree = BIT(M)
for x in A:
  Tree.add(x,1)
ans = 0
for i in range(N):
  for j in range(i+1,N):
    x = A[i]; y = A[j]
    Tree.add(x,-1);Tree.add(y,-1)
    MIN = abs(x-y)+1; MAX = (x+y)-1
    #print(x,y,MIN,MAX)
    ans += Tree.get(MIN,MAX)
    Tree.add(x,1);Tree.add(y,1)
    #print(ans)
print(ans//3) class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
 
    def to_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= (i & -i)
        return s
 
    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
    def get(self, i, j):
        return self.to_sum(j)-self.to_sum(i-1) BIT def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
 
     __init__ self.n = n self.n self n n self.data = [0]*(n+1) self.data self data [0]*(n+1) [0] 0 n+1 n 1 self self n n def to_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= (i & -i)
        return s
 
     to_sum s = 0 s 0 while i > 0:
            s += self.data[i]
            i -= (i & -i)
         i > 0 i 0 s += self.data[i] s self.data[i] self.data self data i i -= (i & -i) i i & -i i -i i return s s self self i i def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
     add while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
     i <= self.n i self.n self n self.data[i] += x self.data[i] self.data self data i x i += (i & -i) i i & -i i -i i self self i i x x def get(self, i, j):
        return self.to_sum(j)-self.to_sum(i-1) get return self.to_sum(j)-self.to_sum(i-1) self.to_sum(j)-self.to_sum(i-1) self.to_sum(j) self.to_sum self to_sum j self.to_sum(i-1) self.to_sum self to_sum i-1 i 1 self self i i j j N = int(input()) N int(input()) int input() input A = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split A.sort() A.sort A sort M = pow(10,6)+ 100 M pow(10,6)+ 100 pow(10,6) pow 10 6 100 Tree = BIT(M) Tree BIT(M) BIT M for x in A:
  Tree.add(x,1) x A Tree.add(x,1) Tree.add Tree add x 1 ans = 0 ans 0 for i in range(N):
  for j in range(i+1,N):
    x = A[i]; y = A[j]
    Tree.add(x,-1);Tree.add(y,-1)
    MIN = abs(x-y)+1; MAX = (x+y)-1
    #print(x,y,MIN,MAX)
    ans += Tree.get(MIN,MAX)
    Tree.add(x,1);Tree.add(y,1)
    #print(ans) i range(N) range N for j in range(i+1,N):
    x = A[i]; y = A[j]
    Tree.add(x,-1);Tree.add(y,-1)
    MIN = abs(x-y)+1; MAX = (x+y)-1
    #print(x,y,MIN,MAX)
    ans += Tree.get(MIN,MAX)
    Tree.add(x,1);Tree.add(y,1)
    #print(ans) j range(i+1,N) range i+1 i 1 N x = A[i] x A[i] A i y = A[j] y A[j] A j Tree.add(x,-1) Tree.add Tree add x -1 Tree.add(y,-1) Tree.add Tree add y -1 MIN = abs(x-y)+1 MIN abs(x-y)+1 abs(x-y) abs x-y x y 1 MAX = (x+y)-1 MAX (x+y)-1 x+y x y 1 ans += Tree.get(MIN,MAX) ans Tree.get(MIN,MAX) Tree.get Tree get MIN MAX Tree.add(x,1) Tree.add Tree add x 1 Tree.add(y,1) Tree.add Tree add y 1 print(ans//3) print ans//3 ans 3 x = A[i] A[i] x N = int(input()) int(input()) N class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
 
    def to_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= (i & -i)
        return s
 
    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
    def get(self, i, j):
        return self.to_sum(j)-self.to_sum(i-1) class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
 
    def to_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= (i & -i)
        return s
 
    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
    def get(self, i, j):
        return self.to_sum(j)-self.to_sum(i-1) BIT Tree = BIT(M) BIT(M) Tree MIN = abs(x-y)+1 abs(x-y)+1 MIN ans = 0 0 ans ans += Tree.get(MIN,MAX) Tree.get(MIN,MAX) ans MAX = (x+y)-1 (x+y)-1 MAX y = A[j] A[j] y A = list(map(int,input().split())) list(map(int,input().split())) A M = pow(10,6)+ 100 pow(10,6)+ 100 M
class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0]*(n+1)
 
    def to_sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= (i & -i)
        return s
 
    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += (i & -i)
 
    def get(self, i, j):
        return self.to_sum(j)-self.to_sum(i-1)



N = int(input())
A = list(map(int,input().split()))
A.sort()
M = pow(10,6)+ 100
Tree = BIT(M)
for x in A:
  Tree.add(x,1)
ans = 0
for i in range(N):
  for j in range(i+1,N):
    x = A[i]; y = A[j]
    Tree.add(x,-1);Tree.add(y,-1)
    MIN = abs(x-y)+1; MAX = (x+y)-1
    #print(x,y,MIN,MAX)
    ans += Tree.get(MIN,MAX)
    Tree.add(x,1);Tree.add(y,1)
    #print(ans)
print(ans//3)