input = readlines()
n = input.shift.chomp.to_i
list = input.shift.chomp.split("\s").map{|x| x.to_i}

cnt = 0
list.each_with_index do |l1, i1|
  list.each_with_index do |l2, i2|
    next if i2 <= i1
    list.each_with_index do |l3, i3|
      next if i3 <= i2
      tmp = [l1, l2, l3].sort
      cnt += 1 if tmp[0] + tmp[1] > tmp[2] && tmp.uniq.length == 3
    end
  end
end

puts cnt
