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
2013-01-17 11:41:40 SudShekhar
long long gives TLE ... Got AC after changing it :)
2013-01-16 10:44:09 saket diwakar
thanx @ Kushagra Jaiswal.....that really helped...:)
2013-01-03 08:06:47 Santiago Palacio
@robertbean O(N^3log(N^3)) = O(N^3log(N)), not N^4. And for quicksort, you can pretty much trust in the expected time, not worst-case time.
2012-12-29 02:48:39 robertbean
Got AC. But confused about something. I see lots of people talking about O(N^3 log N), well, I used qsort for two N^3 size arrays, which I think average time is O(N^3 * logN^3) thus is O(N^4logN), and the worst case is O(N^6). Well, didn't expect I can pass with this, but it did got accepted, strange..

Last edit: 2012-12-29 02:58:58
2012-12-27 11:05:43 符号器
can ny 1 suggest which sorting tcnq will be used .... here merge sort bound me for size of array and quick sort bound me for time complexity....
2012-12-10 08:12:50 Santiago Palacio
Well... i don't know why people is complaining that much about STL. My solution uses only STL and an O(n^3 log(n)) solution and it passed. (further improvement is possible, but STL and a well thinked algorithm is enough).

EDIT: Also my solution uses long long...

Last edit: 2012-12-10 08:14:12
2012-11-02 12:34:08 Dario Pavlovic
im getting a sigsegv on judge(11). can someone help, please? 7981390
2012-10-22 09:51:03 Boopathi Rajaa
Finally AC ... O(n^3 log n)
2012-09-11 02:14:31 Hossam El-Deen Goodname
@Devu
Check Source Limit at the end of the problem :)
2012-08-16 16:46:53 KJ
use sort function in place of qsort.
finaly AC :)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.