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
Jesús Gómez: 2010-06-05 20:20:36

The pdf and ps is bad. I can't see the formula.

Sandytea: 2010-05-05 11:11:37

I used hash to solve this problem and my program ran for 8.98s.

Daniel Ampuero: 2010-04-05 17:49:23

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.

Brian Bi: 2010-01-06 07:17:31

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
majid: 2009-08-25 05:37:36

YES Alex, time limit is strict for java ...
authors before setting time limit must check the problem in java and then set time limit :-|

Alex Erofeev: 2009-08-16 12:17:22

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

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