ABCDEF - ABCDEF


You are given a set S of integers between -30000 and 30000 (inclusive).

Find the total number of sextuples  that satisfy: 

 

Input

The first line contains integer N (1 ≤ N ≤ 100), the size of a set S.

Elements of S are given in the next N lines, one integer per line. Given numbers will be distinct.

Output

Output the total number of plausible sextuples.

Examples

Input:
1
1

Output:
1
Input:
2
2
3

Output:
4
Input:
2
-1
1

Output:
24
Input:
3
5
7
10

Output:
10



hide comments
anroc: 2016-11-08 23:26:41

shvkppl: binary-search is just a way to solve it, and not the most efficient one, IMHO.

shvkppl: 2016-11-04 17:43:34

is this actually a binary-search problem?

adityaronanki: 2016-10-20 15:51:50

can some one please explain me the question by solving a testcase manually....since i didnt understand the question

karthik1997: 2016-09-28 18:47:35

Even though unordered_map uses O(n^3) and bounds uses O(n^3logn) ,, map tle's while upper and lower bound got ac

hamjosh1: 2016-09-10 13:41:09

My 15th :P . Tricky one case when D==0

Shivam: 2016-09-07 10:10:50

HashMap<Integer , Integer> times out. Any ideas why ?

Mihir Saxena: 2016-09-04 13:17:38

Kept on getting a TLE repeatedly on using MAP structure, just replaced the map keyword by unordered_map all over the program, rest of the code was the same and got accepted :)

manish3749: 2016-08-19 17:33:01

accepted in 2nd go
--> 2 vectors for lhs nd rhs
--> 1 sort function for rhs vector
--> lower and upper for lhs in rhs
--> cout<<ub-v2.begin())-(lb-v2.begin();

chaturvedi: 2016-08-06 21:59:05

how is it happening can't understand plz help

sieunhanbom04: 2016-08-04 07:12:21

Map will make you get TLE. Use lower_bound and upper_bound guys. O(n^3.logn). GL


Added by:Luka Kalinovcic
Date:2009-07-13
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:own problem