N = gets.to_i
Ls = gets.split.map(&:to_i)

ans = 0
Ls.combination(3).to_a.each do |a, b, cc|
  next if a == b || b == cc || cc == a
  if a < b + cc || b < a + cc || cc < a + b
    ans += 1
  end
end


puts ans
