require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
l = gets.chomp.split.map(&:to_i)
l.sort!

ans = 0
(n-2).times do |i|
  (i+1).upto(n-2) do |j|
    (j+1).upto(n-1) do |k|
      if l[i] + l[j] > l[k] && l[i] != l[j] && l[i] != l[k] && l[k] != l[j]
        ans += 1
      end
    end
  end
end

puts ans