Connected Components
An undirected graph has vertices (numbered ) and edges. How many connected components does it have?
Input
and , then lines u v.
Output
The number of components.
Constraints
,
Sample 1
Input
5 3 1 2 2 3 4 5
Output
2
Sample 2
Input
3 0
Output
3