Sumx
Consider a set of n distinct positive integers a1, a2, ..., an, having values between 1 and 1000000 and an integer x. Write a program sumx to determine the number of pairs (ai, aj), where 1 <= i < j <= n and ai + aj = x.
Input
The first line of the standard input contains the integer n (1 <= n <= 100000). The second line contains n integers – the elements of the set. On the third line the integer x is given (1 <= x <= 2000000).
Remark: In 50% of test cases, n <= 1000.
Output
The program should output on a single line of the standard output an integer – the calculated number of pairs.
Constraints
Time limit: 1 second
Memory limit: 64 megabytes
Examples
input 9 5 12 7 10 9 1 2 3 11 13 | output 3 |
Explanation: The different pairs with sum 13 are: (12, 1), (10, 3) and (2, 11).