P27057 [AtCoder] Welcome Freshmen Sequence 2
提高
题目描述

Problem Description

PAKEN, now a sophomore, decided to gift a sequence of integers of length $N$, denoted as $A$, as part of the welcoming event for new students. Being well-informed, he learned that there are two popular integers among the freshmen, which are $P$ and $Q$. Believing that the sequence $A$ would be more appreciated if it has a close relationship with $P$ and $Q$, he aims to count how many tuples of integers $(x, y, z)$ satisfy all the following conditions:

  • $1 \leq x$
  • $A_x + A_y + A_z = P$
  • $A_x - A_y - A_z = Q$

Being a lazy person, PAKEN decided to delegate this task to you. Please find the number of tuples $(x, y, z)$ that meet the above conditions.

Input Format

The input is given from the standard input in the following format:

$N$ $P$ $Q$
$A_1$ $A_2$ $...$ $A_{N-1}$ $A_N$

Output Format

Output the number of tuples $(x, y, z)$ that satisfy the conditions.

Sample Input and Output

Sample Input #1

4 10 5
3 3 2

Sample Output #1

2

Sample Input #2

5 22 -91
7 9 3 -2

Sample Output #2

0

Sample Input #3

10 10 68
1 8 1 8 1 8 1 8 1

Sample Output #3

20

Notes/Hints

Constraints

  • All inputs are integers.
  • $3 \leq N \leq 10^5$
  • $-10^9 \leq P, Q \leq 10^9$
  • $-10^9 \leq A_i \leq 10^9$
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 10 05 3 3 2
样例输出
2