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
2010-06-05 20:20:36 Jesús Gómez
The pdf and ps is bad. I can't see the formula.
2010-05-05 11:11:37 Sandytea
I used hash to solve this problem and my program ran for 8.98s.
2010-04-05 17:49:23 Daniel Ampuero
I'm a user and defender of C++, but sometimes I like to use other languages (ie: Python). Nevertheless, I found myself with two algorithms, one in C++ and other in Python with the same time complexity and only the C++ solution pass. Isn't possible to include a multiplier to each language? For instance, in USACO the Java language has 1.5x multiplier running time. That can be done "easily" on the SPOJ grader, IMHO.
2010-01-06 07:17:31 Brian Bi
This issue has been discussed numerous times before and the consensus is generally that there is no way to make time limits fair for everybody. For example, right now maybe the time limit is set so that O(n3 log n) passes in C++ but O(n4) does not. If it were increased enough to allow O(n3 log n) solutions to pass in slow languages, then sub-optimal, O(n4) solutions in C++ would probably pass.

Usually it is decided that the status quo is better than this hypothetical situation of letting non-optimal algorithms pass, so that, in essence, your only option is to learn a faster language like C++. (Think about all the future trouble that would save you anyway.)


Last edit: 2010-01-06 07:18:50
2009-08-25 05:37:36 majid
YES Alex, time limit is strict for java ...
authors before setting time limit must check the problem in java and then set time limit :-|
2009-08-16 12:17:22 Alex Erofeev
Isn't time limit for this problem too strict? My solution in java got tle, but when I rewrote the same code in cpp it got ac.
May be there is more optimal solution but i think if it is so, limits should be set to cut all non-optimal solutions in every language

Last edit: 2009-08-16 12:19:54
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.