Problems
SumX
SumX
Consider an array of n positive integers a1
, a2
, ..., an
, having values between 1 and 106
and an integer x. Write a program to determine the number of pairs (ai
, aj
), where 1 ≤ i < j ≤ n and ai
+ aj
= x.
Input
The first line contains the integer n (1 ≤ n ≤ 105
). The second line contains n integers - the elements of array that can be repeated. On the third line the integer x (1 ≤ x ≤ 2 * 106
) is given.
Output
Print the calculated number of pairs.
Input example #1
9 5 12 7 10 9 1 2 3 11 13
Output example #1
3
Input example #2
6 1 2 2 2 3 4 5
Output example #2
4