
# 棒の本数
n = gets.to_i
# 棒の長さ
a = gets.chomp.split.map(&:to_i).sort.reverse
# 答えの変数
sum = 0
# 全探索
(n - 2).times do |i|
  ((i + 1)..(n - 1)).each do |j|
    next if a[i] == a[j]
    ((j + 1)..n),each do |k|
      next if a[i] + a[j] <= a[k] || a[j] == a[k]
      sum += 1
    end
  end
end
puts sum