N = gets.to_i
L = gets.split.map(&:to_i)

c = 0

(N - 2).times do |i|
  ((i+1)...(N-1)).each do |j|
    ((j+1)...(N)).each do |k|
      if (L[i]!=L[j])&&(L[i]!=L[k])&&(L[j]!=L[k]) then
        s = [L[i],L[j],L[k]].sort
        b = (s[1] - s[2]).abs
        if b < s[0] && s[0] < s[1] + s[2] then
          c += 1
        end
      end
    end
  end
end

puts c
