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



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

hide comments
2011-12-18 15:43:35 bristy
can anyone give more challenging test cases.......
2011-12-16 05:50:38 kshitij agrawal
@iwillambush
You finally got AC though :) cheers !!
2012-01-17 06:32:34 SARIH Mohamed
Important test case:
2
0 1
12
Other test case:
4
3 0 1 -4
178
2012-04-11 13:55:50 wil93
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
2011-07-29 14:19:40 Ajey Golsangi
I give up. https://www.spoj.pl/status/ABCDEF,iwillambush/

Last edit: 2011-07-29 14:20:18
2011-07-18 08:16:33 512_I
@Luka Kalinovcic: Can u tell me y m getting NZEC again and again, I m in big trouble :(
2011-06-03 06:39:41 Santiago Palacio
Aman, the result is for all runs, each run has 2s.
2011-05-16 04:50:17 Castiel
how do u do it for O(n^4)????plz help
2011-01-07 16:55:53 Rajesh Kv
@majid: You are right.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.