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:
20100605 20:20:36
The pdf and ps is bad. I can't see the formula. 

Sandytea:
20100505 11:11:37
I used hash to solve this problem and my program ran for 8.98s. 

Daniel Ampuero:
20100405 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:
20100106 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(n^{3} log n) passes in C++ but O(n^{4}) does not. If it were increased enough to allow O(n^{3} log n) solutions to pass in slow languages, then suboptimal, O(n^{4}) solutions in C++ would probably pass.


majid:
20090825 05:37:36
YES Alex, time limit is strict for java ...


Alex Erofeev:
20090816 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.

Added by:  Luka Kalinovcic 
Date:  20090713 
Time limit:  1s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 
Resource:  own problem 