
input_str = gets
input_str = gets
lines = input_str.split.collect{|l| l.to_i}.sort.reverse

count = 0
prev_a = nil
p lines
while 3 <= lines.size do
  b_lines = lines[1..-1]
  a = lines.shift
  while 2 <= b_lines.size do
    c_lines = b_lines[1..-1]
    b = b_lines.shift
    next if a == b
    c_lines.each do |c|
      next if (a == c) || (b == c)
      puts("a=#{a}, b=#{b}, c=#{c}")
      break if (b + c) <= a
      count += 1
    end
  end
  prev_a = a
end

puts count

