Count Triangles

Anuj likes to play with sticks. He uses them to form triangles by arranging any 3 sticks in some order. But this time, Anuj has a set of N sticks and he wants to count the number of distinct triangles he can form using these sticks. Triangles should be non-degenerated.

Return the count of distinct triangles that can be formed using the set.

Input Format:

Line 1 : Integer N (number of sticks in the set) (3<=|N|<=1000)

Line 2 : N spaced integers denoting the length of its stick

Sample Input 1:
5 4 3
Sample Output 1:

Login to submit your solution

Fb dab53a1a64929320dc7425896aa73fd9e5512b6ab52e414ff5f3ebb5cecc73eb

Share Problem