N = gets.to_i
L = gets.split.map(&:to_i).sort
SZ = L.size

ans = 0
(0...SZ-2).each do |i|
  (i+1...SZ-1).each do |j|
    (j+1...SZ).each do |k|
      a,b,c = L[i], L[j], L[k]
      next if a == b || a == c || b == c
      next if a + b <= c
      ans += 1
    end
  end
end
puts ans
