Consider an array of n positive integers a[1]
, a[2]
, ..., a[n]
, having values between 1 and 10^6
and an integer x. Write a program to determine the number of pairs (a[i]
, a[j]
), where 1 ≤ i < j ≤ n and a[i]
+ a[j]
= x.
The first line contains the integer n (1 ≤ n ≤ 10^5
). The second line contains n integers - the elements of array that can be repeated. On the third line the integer x (1 ≤ x ≤ 2 * 10^6
) is given.
Print the calculated number of pairs.