Competitions

# S.C.

# Zero quintuples

You are given a sequence of **n** distinct integers `a`

, _{1}`a`

, ..., _{2}`a`

. _{n}**Zero quintuple** is any five numbers `a`

, _{i}`a`

, _{j}`a`

, _{k}`a`

, _{p}`a`

(_{q}**i** < **j** < **k** < **p** < **q**) which sum to zero (`a`

+ _{i}`a`

+ _{j}`a`

+ _{k}`a`

+ _{p}`a`

= _{q}**0**). Find the number of distinct zero quintuples from the given sequence.

#### Input

The first line contains **n** (**5** ≤ **n** ≤ **2000**) - number of elements in a sequence. The next line contains **n** distinct integers `a`

, _{1}`a`

, ..., _{2}`a`

(_{n}**-10000** ≤ `a`

≤ _{i}**10000**) - elements of the sequence.

#### Output

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

Input example #1

7 -4 2 3 -1 5 0 -2

Output example #1

2