A company has n employees, numbered 1 through n, and m collaboration links. Each link connects two employees, and collaboration is mutual. Two employees are reachable from each other if a chain of collaboration links connects them.
Count the number of unordered pairs {i, j} with i != j such that i and j are reachable from each other.
Input format
- Line 1: two integers
nandm. - Next
mlines: two integersuandv(1-indexed,u != v), a collaboration link.
Output format
A single integer: the number of reachable unordered pairs.
Constraints
- 1 <= n <= 100000
- 0 <= m <= 200000
- 1 <= u, v <= n and u != v