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

a.sort_by!{|e| e}

count = 0

(0...n-2).each do |i|
  (i+1...n).each do |j|
    if a[i] == a[j]
      next
    end
    (j+1...n).each do |k|
      if a[i] == a[k]
        next
      end
      if a[j] == a[k]
        next
      end
      #puts("#{i},#{j},#{k}")
      #puts("#{a[i]},#{a[j]},#{a[k]}")
      if a[i] + a[j] > a[k]
        count += 1
      end
    end
  end
end

p count