N = gets.to_i
L = gets.chomp.split.map(&:to_i)
ans = 0

(0..N-1).each do |a|
  (0..N-1).each do |b|
    (0..N-1).each do |c|
x = L[a] 
y = L[b]
z = L[c]
if x != y && y != z && x != z && 2*[x,y,z].max<x+y+z
  ans += 1
end
end
end
end

puts ans/6
