local read = io.read
local insert = table.insert

local N = read("n")
local L = {}
local L_have_same_num = {}
for i = 1, N do
	local num = read("n")
	if L_have_same_num[num] == nil then
		insert(L, num)
		L_have_same_num[num] = 1
	else
		L_have_same_num[num] = L_have_same_num[num] + 1
	end
end

table.sort(L)

local count = 0
for i = 1, #L - 2 do
	for j = i + 1, #L - 1 do
		for k = j + 1, #L do
			if L[k] >= L[j] + L[i] then
				break
			end
			count = count + L_have_same_num[L[i]] * L_have_same_num[L[j]] * L_have_same_num[L[k]]
		end
	end
end

print(count)
