P2141 [NOIP 2014 Junior] Mental Abacus Test
Background
NOIP 2014 Junior T1.
Description
Mental abacus is a calculation technique that performs fast computation by simulating abacus operations in the mind. Training in mental abacus can both develop intelligence and bring convenience to daily life, so it has become popular in many schools.
A mental abacus teacher at a certain school uses a quick test method to assess addition skills. He randomly generates a set of positive integers, all distinct, and asks the students: how many numbers in the set are exactly equal to the sum of two other (different) numbers from the same set?
Recently, the teacher prepared some test questions. Please help compute the answers.
Input Format
There are two lines. The first line contains an integer $n$, the number of positive integers in the test.
The second line contains $n$ positive integers separated by single spaces, representing the given positive integers in the test.
Output Format
Output a single integer, which is the answer to the test.
Explanation/Hint
[Sample Explanation]
From $1+2=3,1+3=4$, so the number of values that meet the requirement is $2$.
Note that the addends and the sum must be three numbers from the set, and the two addends must be different.
[Constraints]
For $100\%$ of the testdata, $3 \leq n \leq 100$, and each given positive integer does not exceed $10{,}000$.
Translated by ChatGPT 5