题目描述
You are given a sequence of integers $a_1, a_2, ..., a_N$. An element ak is said to be an average element if there are indices $i, j$ (with $i \neq j$) such that $a_k = \frac{a_i + a_j}{2}$.
In the sequence
$371022171537102217153 \quad 7 \quad 10 \quad 22 \quad 17 \quad 15$
for $i=1, j=5$ and $k=3$, we get $a_k = \frac{a_i + a_j}{2}$. Thus $a_3 = 10$ is an average element in this sequence. You can check that $a_3$ is the only average element in this sequence.
Consider the sequence
$371031837103183 \quad 7 \quad 10 \quad 3 \quad 18$
With $i=1, j=4$ and $k=1$ we get $a_k = \frac{a_i + a_j}{2}$. Thus $a_1=3$ is an average element. We could also choose $i=1, j=4$ and $k=4$ and get $a_k = \frac{a_i + a_j}{2}$. You can check that $a_1$ and $a_4$ are the only average elements of this sequence.
On the other hand, the sequence
$38111730381117303 \quad 8 \quad 11 \quad 17 \quad 30$
has no average elements.
Your task is to count the number of average elements in the given sequence.
-----Input:-----
The first line contains a single integer $N$ indicating the number of elements in the sequence. This is followed by $N$ lines containing one integer each (Line $i+1$ contains $a_i$). (You may assume that $a_i + a_j$ would not exceed MAXINT for any $i$ and $j$).
-----Output:-----
The output must consist of a single line containing a single integer $k$ indicating the number of average elements in the given sequence.
-----Constraints:-----
- You may assume that $1 \leq N \leq 10000$.
- In $30 \%$ of the inputs $1 \leq N \leq 200$.
- In $60 \%$ of the inputs $1 \leq N \leq 5000$.
-----Sample Input 1:-----
6
3
7
10
17
22
15
-----Sample Output 1:-----
1
-----Sample Input 2:-----
5
3
7
10
3
18
-----Sample Output 2:-----
2
-----Sample Input 3;-----
5
3
8
11
17
30
-----Sample Output 3:-----
0
输入格式
见题面
输出格式
见题面