Competitions

# Zero quintuples

You are given a sequence of n distinct integers a1, a2, ..., an. Zero quintuple is any five numbers ai, aj, ak, ap, aq (i < j < k < p < q) which sum to zero (ai + aj + ak + ap + aq = 0). Find the number of distinct zero quintuples from the given sequence.

#### Input

The first line contains n (5n2000) - number of elements in a sequence. The next line contains n distinct integers a1, a2, ..., an (-10000ai10000) - elements of the sequence.

#### Output

Print one integer - the number of zero quintuples in a given sequence.

Time limit 1 second
Memory limit 128 MiB
Input example #1
7
-4 2 3 -1 5 0 -2

Output example #1
2

Source 2014 KBTU Open, Spring Kazakhstan, Almaty, April 20, Problem K