SumX
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
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.
Input
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.
Output
Print the calculated number of pairs.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 377
Acceptance rate 36%