while
  n = gets
  if ! n then
    exit
  end
  n=n.chomp.to_i

  ls = gets.chomp.split(' ').map { | x | x.to_i}

  count = 0
  r = 0.upto(ls.size-1).to_a
  r.combination(3).uniq.each { | a,b,c |
    aa,bb,cc = [ls[a],ls[b],ls[c]].sort { | x,y | y <=> x}
#    p [[a,b,c], [aa,bb,cc]]
#    p [a,b,c]
    if (aa < bb+cc && aa != bb && aa != cc && bb != cc) then
#      p [a,b,c]
      count = count + 1
    end
  }
  puts count

end

