LearnPy Hub
← Arena
IntermediateRating 1400

How Many Triangles?

Count the ways to choose three sticks (different positions) that can form a triangle with positive area.

Input

n (n ≤ 2000), then n lengths.

Output

One integer.

Sample 1

Input
4
2 2 3 4
Output
3

Sample 2

Input
4
4 2 3 4
Output
4
solution.py
Output appears here
How Many Triangles? · Python Arena problem · LearnPy Hub