Hide

Triangular Collection

Call a set of positive integers triangular if it has size at least three and, for all triples of distinct integers from the set, a triangle with those three integers as side lengths can be constructed.

Given a set of positive integers, compute the number of its triangular subsets.

Input

The first line of input contains a single integer $n$ ($1 \le n \le 50$), which is the number of integers in the set.

Each of the the next $n$ lines contains a single integer $x$ ($1 \le x \le 10^9$). These are the elements of the set. They are guaranteed to be distinct.

Output

Output a single integer, which is the number of triangular subsets of the given set.

Sample Input 1 Sample Output 1
5
3
1
5
9
10
2
Sample Input 2 Sample Output 2
10
27
26
17
10
2
14
1
12
23
39
58
CPU Time limit 1 second
Memory limit 2048 MB
Difficulty 6.2hard
Statistics Show
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in