N = gets.to_i
L = gets.split.map(&:to_i)
L.sort!
r = 0
(0 .. N - 3).each{|i|
    (i + 1 .. N - 2).each{|j|
        next if L[i] == L[j]
        (j + 1 .. N - 1).each{|k|
            next if L[j] == L[k]
            break if L[i] + L[j] <= L[k]
            r += 1
        }
    }
}
puts r
