#P15754. [JAG 2025 Summer Camp #1] Dyad
[JAG 2025 Summer Camp #1] Dyad
题目描述
A shop sells sweets in pairs.
There are products. The -th product contains a pair of sweets: one of type and one of type . and may be equal.
If you buy two different products, you will obtain four sweets in total. There are twins, and you want to give exactly two sweets to each of them. The twins are only satisfied if the multiset of sweet types received by each twin is identical.
Count the number of ways to choose two different products such that it is possible to distribute the sweets to the twins in this way.
输入格式
The input is given in the following format:
$$\begin{aligned} &N \\ &A_1 \ B_1 \\ &A_2 \ B_2 \\ &\vdots \\ &A_N \ B_N \end{aligned} $$- ()
- All input values are integers.
输出格式
Output the answer in a single line.
4
2 3
3 2
1 1
2 2
2