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
bristy: 2011-12-18 15:43:35

can anyone give more challenging test cases.......

kshitij agrawal: 2011-12-16 05:50:38

@iwillambush
You finally got AC though :) cheers !!

SARIH Mohamed: 2012-01-17 06:32:34

Important test case:
2
0 1
12
Other test case:
4
3 0 1 -4
178

wil93: 2012-04-11 13:55:50

My algorithm's complexity is O(n^3 lg n) why the hell am I getting TLE?
I have to say it has a quite high constant factor

UPD: Testing with N=100 I was getting 2.5 sec (I can't believe STL containers are SO slow) now I switched to "simpler" vectors (doing some more manual work), and cut down to 1.5 sec with the same input. TLE AGAIN O.o

UPD: Got AC in 11.32 sec after a needless optimization (furthermore: on my pc this 'optimization' have slightly increased execution time -.-)

Last edit: 2011-07-30 11:30:36
Ajey Golsangi: 2011-07-29 14:19:40

I give up. https://www.spoj.pl/status/ABCDEF,iwillambush/

Last edit: 2011-07-29 14:20:18
512_I: 2011-07-18 08:16:33

@Luka Kalinovcic: Can u tell me y m getting NZEC again and again, I m in big trouble :(

Santiago Palacio: 2011-06-03 06:39:41

Aman, the result is for all runs, each run has 2s.

Castiel: 2011-05-16 04:50:17

how do u do it for O(n^4)????plz help

Rajesh Kv: 2011-01-07 16:55:53

@majid: You are right.


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