n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
i = 0
array = []
bs = []
while i < n
  j = i+1
  while j < n
    k = j+1
    while k < n
      a = [arr[i],arr[j],arr[k]]
      b = [i+1,j+1,k+1]
      if arr[i]==arr[j] || arr[j]==arr[k] || arr[k]==arr[i] 
      else
        a.sort!
        if a[0] + a[1] > a[2]  
          array << a
          bs << b
        end
      end
      k += 1
    end
    j += 1
  end
  i += 1
end
p array.size