#C11968. Count Pair Combinations
Count Pair Combinations
Count Pair Combinations
You are given a sequence of N positive integers. Your task is to count the number of distinct pairs (i, j)
such that 1 ≤ i < j ≤ N
. Although the sequence is provided as input, the answer depends solely on the value of N
.
Recall that the total number of ways to choose 2 distinct indices from N
elements is given by the formula:
\( \frac{N \times (N-1)}{2} \)
Compute and output this number.
inputFormat
The input is read from stdin and consists of two lines:
- The first line contains a single integer
N
(the number of elements in the sequence). - The second line contains
N
space-separated positive integers representing the sequence.
outputFormat
Output a single integer to stdout which is the number of valid pairs (i, j)
satisfying 1 ≤ i < j ≤ N
.
Note: You do not need to use the sequence values for the computation.
## sample5
1 2 3 4 5
10
</p>