def qual(a,b,c)
  if (a + b > c) && (a + c > b) && (b + c > a)
    return true
  else
    return false
  end
end
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
i = 0
cand = []
while i < n - 2
  j = i + 1
  while j < n - 1
    k = j + 1
    while k < n
      cand.push([arr[i],arr[j],arr[k]])
      k += 1
    end
    j += 1
  end
  i += 1
end
count = 0
cand.each do |trio|
  unless trio.uniq.size != 3
    if qual(trio[0],trio[1],trio[2])
      count += 1
    end
  end
end
puts count