#K92922. Unique Pair Sum
Unique Pair Sum
Unique Pair Sum
You are given an array of integers and a target integer \(X\). Your task is to count the number of unique pairs \((a, b)\) in the array such that \(a + b = X\). A pair is considered unique if the combination of numbers is not repeated, regardless of their order.
Note: Each pair should be counted only once. For example, in the array [1, 5, 7, -1, 5] with \(X = 6\), the valid pairs are (1, 5) and (7, -1), so the answer is 2.
inputFormat
The input is read from standard input (stdin) and has the following format:
n a1 a2 a3 ... an X
where:
n
is an integer representing the number of elements in the array.a1, a2, ..., an
are the array elements (integers).X
is the target sum.
outputFormat
Output a single integer representing the number of unique pairs \((a, b)\) in the array that satisfy \(a + b = X\). The result should be printed to standard output (stdout).
## sample5
1 5 7 -1 5
6
2
</p>