Given a sequence of integers: a_1, a_2, \dots, a_n, and an integer . Consider pairs (a_i, a_j) of elements from this sequence such that i < j.
Write a program that finds a pair whose sum (a_i + a_j) is closest (or equal) to , and prints the total number of pairs whose sums are at the same minimal distance from .
The first line contains an integer n~(1 < n \le 10^6).
The second line contains the integers a_1, a_2, \dots, a_n~(-10^4 \le a_i \le 10^4, 1 \le i \le n).
The third line contains the integer v~(-10^4 \le v \le 10^4).
Print one integer — the number of pairs whose sum is closest to .
It is impossible to obtain exactly the sum v = 12, but we can find a sum that is closest to , for example 2 + 11 = 13. The distance between v = 12 and is . There are also other pairs whose sums differ from by the same minimal distance: 2 + 9 = 11, 2 + 9 = 11, 5 + 8 = 13. The total number of such pairs is .
Note that the pair is counted twice, since the sequence contains two distinct positions with the same values.
Example 1