n = gets.chomp.to_i
l = gets.split.map(&:to_i)
a = 0
#i,j,k = 0
for i in 0..n-1 do
    for j in 0..n-1 do
        for k in 0..n-1 do
            if (l[i] < l[j] + l[k] ) && (l[j] < l[k] + l[i] ) && (l[k] < l[i] + l[j] ) && i != j && j != k && k != i && l[i] != l[j] && l[j] != l[k] && l[k] != l[i] then
                a = a + 1
            end
        end
    end
end
puts a/6
# 