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
2019-01-16 13:15:13
In 11th test case d=0 so don't forget to apply a check.
2019-01-13 11:56:14
AC in one go.
2018-12-18 18:05:05
TO SOLVE THE PROBLEM ALL SEXTUPLES SHOULD BE GENERATED OR NOT?
2018-08-21 09:19:28
how binary search works ?
2018-08-19 04:40:27
Remember d!=0
2018-08-11 09:57:19
AC in one go, teaches complexity optimization using Meet in The Middle
2018-07-07 21:10:02
I thought it would be a binary search question (one with true false conditons) but this one uses binary search from STL :|

Last edit: 2018-07-07 21:10:22
2018-07-04 17:34:21
ac at 3rd go


Last edit: 2018-07-04 17:59:17
2018-06-07 10:33:25
my complexity is O(n^3*(log n)^2) how to reduce it?

Last edit: 2018-06-07 10:33:55
2018-06-01 06:58:46
I didn't get how O(N^3 + hashing) > O(N^3*logN). Any help?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.