# 2022 IUSB Programming Competition
# Round 1 Problem 5
# Triangles
# Solution by Janet Yu (high school volunteer)
# Uses Python 3.9.5
if __name__ == '__main__':
m = int(input())
str = input().split(" ")
sides = []
sides = [0 for i in range (m)]
result = 0
for i in range(0, m):
sides[i] = int(str[i])
for i in range (0, m):
for j in range (i+1, m):
for k in range (j+1, m):
if sides[i]+sides[j]>sides[k] and sides[i]+sides[k]>sides[j] and sides[j]+sides[k]>sides[i]:
result += 1
print (result)