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
Ankit Sultana: 2015-02-07 16:25:06

Changed int *arr; arr = new int[n]; to int arr[11100] = {0}; and got AC in less than 2 seconds.

Rang: 2015-02-06 17:03:10

like others have said. tight constraints. be frugal:-)(I guess the author wanted an O(N^3) solution)
Con Bò Huyền Thoại:- please don't steal the fun don't post solutions here! (let's not kill the spark at its inception)

(Francky) ⇒ Links removed.

Last edit: 2015-02-06 19:22:29
Bezzam Varun: 2015-02-04 13:27:59

Some useful points:Don't use vectors. Sort the arrays using STL and check for d!=0 always. Also, there's no need to use binary search. Use a modified version of mergesort algo. AC after 4.5 hours!

Jordan Alexander: 2015-02-01 00:13:44

If anyone else is having problems with the image, the Wayback Machine archived a copy of the problem back when the image still worked.

Anvesh Kumar Arrabochu: 2015-01-16 09:31:14

Can be solved in O(N^3). Hint(C++): unordered_map

eightnoteight: 2015-01-14 14:25:17

don't forget to read Make In India!'s note.. costed me 3 WA


Make In India's Note : 'd' can't be Zero . Gave me WA in 14th test case.

Faisal Ahmed: 2015-01-07 08:24:34

"Error
Language available only on Cube Cluster "
why this massage is being shown when i submit this problem?

reply by vamsi: that was a temporary problem

Last edit: 2015-01-14 17:34:07
sirius: 2015-01-05 14:36:08

Im getting time limit exceeded for case 11,anyone knows why?

Vinay: 2014-12-13 18:56:04

used quick sort and binary search still got TLE for 11th case :/

HARINDER SINGH: 2014-11-22 17:06:17

used map got TLE


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