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



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

hide comments
2016-03-04 23:18:40 enigmus
If you get WA, don't forget to exclude solutions where d == 0

Last edit: 2016-03-04 23:18:51
2016-03-03 20:42:38
using unordered map in java , getting TLE
2016-01-28 21:55:20
Hint for Java programmers: use O(n^3) algorithm and try optimizing the loops a little bit. 3 TLEs and get passed with 1.99s
2016-01-27 11:32:37 Wumbolo
used vectors and lower_bound/upper_bound. Worked great :)
2016-01-26 07:00:52
till 11 I was like :D
Help me out pls!
I have used map
2016-01-22 07:51:46 Harsh Vardhan Ladha
got AC after using unordered_map. Time complexity : O(n^3)
My O(n^3.log(n)) solution was getting WA after 11th test case (didn't used vectors, used modified binary search, and made sure a[k]!=0)

Last edit: 2016-01-22 07:52:47
2015-12-24 15:48:59 DEVVRAT GUPTA
unordered_map cost me a WA, please go with the Binary search...
2015-12-17 13:37:42 Aditya Kumar
nice one
2015-12-05 19:10:03
I was afraid of this problem for many days and then I saw the range of n . . .
2015-12-02 02:01:47 deerishi
use unordered_map c++ 14 , for those getting TLE on test case 11!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.