n = gets.chomp.to_i
l = gets.chomp.split.map(&:to_i)

def eval(l, i, j, k)
  (l[i] + l[j] > l[k]) \
    and (l[j] + l[k] > l[i]) \
    and (l[k] + l[i] > l[j]) \
    and (l[i] != l[j] and l[j] != l[k] and l[k] != l[i])
end

cnt = 0
(0...n).each do |i|
  (i+1...n).each do |j|
    (j+1...n).each do |k|
      if eval(l, i, j, k)
        cnt += 1
      end
    end
  end
end

p cnt