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
deepak100: 2017-05-27 19:31:50

Nice problem. Unable to solve in java .. getting TLE :( ... Accepted with same logic in C :)

venky1001: 2017-05-24 08:54:12

did anyone got accepted in JAVA???

jaykay12: 2017-05-21 12:34:15

Use Vector instead of Array. Sort() of STL instead of qsort. Use upper_bound() & lower_bound() instead of Binary Search & Linear Search. Use scanf instead of cin for faster I/O. Finally AC after 5 TLE's. :(

vivek4434: 2017-04-20 12:51:24

easy one..

ajeetk_973: 2017-04-08 08:10:12

tle->wa->wa->AC :)

Khairo21: 2017-04-06 14:11:47

Good Problem on Meet in the Middle Technique :)
be careful about the arrangement of the loops ;)

Last edit: 2017-04-06 14:12:02
giorgosgiapis: 2017-04-04 21:41:16

Easy one. Upper and lower bound will make your life easier!

crusader_3197: 2017-04-02 08:38:14

how do the top guys got the solution accepted in 0.02s?

sunny: 2017-04-01 12:46:00

careful about d!=0 :)

vineetpratik: 2017-03-27 09:34:47

upper_bound, lower_bound / binary search and d!=0.


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