n = gets.to_i
a = gets.split.map(&:to_i).sort
ans = 0
for i in 0...n-2
  for j in i+1...n-1
    for k in j+1...n
      if a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]
        ans += 1
      end
    end
  end
end
puts ans
