#C2597. Unique Sum Pair Counter

    ID: 45930 Type: Default 1000ms 256MiB

Unique Sum Pair Counter

Unique Sum Pair Counter

Given an array \(A\) of integers and an integer target \(T\), your task is to count the number of unique pairs \((a, b)\) from the array such that

\(a + b = T\).

Each pair is considered unique regardless of order, meaning that the pair \((a, b)\) is the same as \((b, a)\). If there are multiple occurrences of the same numbers, they should only be counted once.

Note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).

inputFormat

The input consists of three parts provided via stdin:

  1. An integer \(N\) representing the number of elements in the array \(A\).
  2. A line with \(N\) space-separated integers representing the array \(A\). If \(N = 0\), this line will be empty.
  3. An integer \(T\) representing the target sum.

outputFormat

Output a single integer representing the number of unique pairs \((a, b)\) such that \(a + b = T\).

## sample
5
1 5 7 -1 5
6
2