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
Menkov Andrey: 2015-05-15 14:39:32

How can I know the number of test case on which my solution is failing?
I'm still getting WA and I don't know why. Check for d != 0 is already present.
Can I post here my solution for getting some help or ideas?
Thank you

alpha coder: 2015-04-01 20:27:24

reduced it to o(n^3) using maps , still getting TLE

swami: 2015-03-05 19:23:27

in java im not sorting but using collections.frequency but getting tle for 11th case

Last edit: 2015-03-05 19:32:10
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

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