n = gets.to_i
l_n = gets.split.map(&:to_i)

ans = 0
(0...n-2).each do |i|
  (i+1...n-1).each do |j|
    (j+1...n).each do |k|
      if l_n[i] != l_n[j] && l_n[j] != l_n[k] && l_n[k] != l_n[i]
        hen = [l_n[i], l_n[j], l_n[k]].sort
        ans += 1 if hen[0] + hen[1] > hen[2]
      end
    end
  end
end
p ans