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
kshubham02: 2016-06-07 12:24:02

The time limit given here is 0.36 seconds. My solution ran in 1.21 seconds and still got AC. Can someone please explain this?

karthik1997: 2016-05-30 08:00:42

For fast execution . Use vectors instead of arrays and maps .. Use Sort instead of qsort .... Use lower and upper bounds or binary_search too ... Use fast i/o and better make complexity <=O(N^3 * log(N) ) ...
PS: Using maps gives tle and unordered_map is OK ... .. So Good luck :D ........

Last edit: 2016-05-30 08:22:57
krishna Murari: 2016-05-25 10:26:08

got AC after 3 TLEs . i was using string as a key for map. that string conversion was taking some time. also use unordered map under g++ 14.

Last edit: 2016-05-25 10:26:29
buttman: 2016-05-14 10:34:32

passed with STL lower_bound and upper_bound but custom implementations of those two functions (binary search) give TLE.
(-_-)
Has anyone solved this without using STL ?

saketj: 2016-05-14 06:49:03

Use sort instead of qsort in stl and also use lower_bound and upper_bound..For faster IO operations use scanf and printf rather than cin and cout

candide: 2016-05-05 00:41:18

No sort, no mapping, no binary sort but only arrays and vectors. The Python code equivalent to my C code gets TLE but I can guess the running time to be near to 5.5s on cube server. PyPy gets AC. C++ unordered_map takes about 1.2s.

Last edit: 2016-06-06 23:02:14
satish9040: 2016-04-29 13:02:21

stl map gives TLE..
lower bound and upper bound works

mohmmedmoued55: 2016-04-06 09:14:12

l don't understand what the problem need?

darkod3r: 2016-03-31 12:51:12

easy one ...got AC in first run :D ... btw good question for STL practice. I used upper and lower bounds instead of binary search.

Yogesh Chauhan: 2016-03-28 22:53:07

Use int instead of long long.
It gives me 13 TLE even after using scanf and I was seriously searching for the improvement after O(n^3).
:'(


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