#C13447. Unique Pair Sums
Unique Pair Sums
Unique Pair Sums
You are given an array of n integers and an integer target. Your task is to count the number of unique pairs in the array such that the sum of the two numbers equals the target. A pair is considered unique if the two numbers have not been paired before, regardless of order.
More formally, you need to find the number of unique pairs \((a, b)\) where \(a+b=target\). Each pair \((a,b)\) should be counted only once, i.e. \((a,b)\) is the same as \((b,a)\).
Input/Output: This problem uses standard input and output. Read input from stdin and print the result to stdout.
inputFormat
The first line contains an integer n representing the number of elements in the array.
The second line contains n space-separated integers representing the elements of the array.
The third line contains an integer target.
outputFormat
Output a single integer - the number of unique pairs whose sum equals the target.
## sample6
1 1 2 45 46 46
47
2