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
2016-06-28 16:15:14
Well quicksort is not fast enough.
2016-06-23 19:43:47
N^3 Solution AC with unordered_map.a*b + c fits in int.
2016-06-23 07:09:14 Tushar Singh
Too much time invested... i just hope it was for a good cause! :/
2016-06-22 14:48:58 kartikay singh
@kshubham
Your 1.21s is time taken for running all the Testfiles.
And given 0.36s is maximum time allowed to a run particular testfile.
2016-06-22 14:46:29 kartikay singh
several WA's + TLE due to overflow
use long long
2016-06-19 09:54:13
@buttman used sort for stl and custom binary search for lower and upper bounds, used arrays, no vectors, 1.68s, c++, dnno why still got AC
2016-06-17 13:02:48
@quantic,i think you just didn't give a try.
Just work with pen and paper for one minutes.
2016-06-17 12:59:54
mine code with binary search was giving tle in ide but the code got accepted by using lower_bound and upper_bound
2016-06-12 13:51:42
please explain the second test case someone!!
2016-06-08 09:52:00 candide
@kshubham02: cf. http://discuss.spoj.com/t/sumfour-time-limit/3837
@abhigupta4:
- unordered_map gets AC but performance is poor, about 1.20s
- you are right, long long are not needed.

Last edit: 2016-06-24 20:58:56
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.