Gehenna Gate (The gate of Hell)

0

0 votes
Easy
Problem

What can be a better place to start your journey than to enter through the Gate of Gehenna itself. But opening the the gate of Gehenna requires you to solve a simple task to check whether you are eligible to enter it or not.

Solve this task and the Gate will open.

Given an Array A of N distinct non-negative integers, print total number of distinct triplets (x, y, z) such that:

  1. x + y = z
  2. x != y AND x != z AND y != z
  3. x, y, z ∈ A

INPUT:
First line contains N followed by N integers in next line.

OUTPUT:
A single Integer as described above.

Constraint:
1 ≤ N ≤ 100

0 <= Ai <= 1000000000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

In this case, triplets are (2,3,5) and (3,2,5).

Editor Image

?