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
(Tjandra Satria Gunawan)(曾毅昆): 2013-10-20 18:07:59

C->stdlib.h->qsort() is very slow :-(
AC using manual sort..

Ouditchya Sinha: 2013-09-23 17:14:38

@santhosh reddy : I'm not sure but I didn't assume the input to be sorted.

santhosh reddy: 2013-09-23 14:16:39

Is the input always sorted???

Vinay Kumar: 2013-09-14 19:27:49

getting TLE any suggestions. <snip>

Last edit: 2023-06-14 21:15:26
Anmol Singh Jaggi: 2013-07-25 02:28:29

Use STL sort() instead of stable_sort()!!
Got many TLE's for that...

Inspiron: 2013-06-05 18:32:43

O(n^3log(n)). n^3log(n),arround 10^7 and its mangble withine a second for a normal computer(PC)

Last edit: 2013-08-01 14:11:23
Ouditchya Sinha: 2013-04-26 12:19:48

Got AC with pretty bad run times, upper_bound & lower_bound works well here. Strange, I got a poor timing of 11.17s with getchar_unlocked & 10.28s with scanf... My time complexity is O( n^3 + n * log(n) ). :)

EDIT: My mistake, getchar_unlocked did give me 10.22s.

Last edit: 2013-04-26 12:41:04
Shawkey: 2013-04-11 21:23:24

is the best solution O(n^3 log(n)) or O(n^3 log(n^3))???

Jay H. Bosamiya: 2013-03-16 07:03:02

O(n^3 lg n) is giving TLE... I'm using STL map... is STL map slow?


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