require "set"

N = gets.to_i
Ls = gets.split.map(&:to_i)

def tri?(a, b, c)
  aa = a ** 2
  bb = b ** 2
  cc = c ** 2
  (aa - bb - cc) > 0 && (bb - cc - aa) > 0 && (cc - aa - bb) > 0
end

results = Set.new

Ls[0..-3].each.with_index do |l, i|
  a = l
  Ls[i + 1..-2].each.with_index do |m, j|
    b = m
    Ls[i + 2..-1].each.with_index do |n, k|
      c = n
      if tri?(a, b, c)
        results.add(Set[a, b, c])
      end
    end
  end
end

puts results.count
