Every season at the island market of Coralcove, someone must rank apprentices for the new term. This year the task falls to Theo, armed only with the roads register. Task: An undirected graph has n nodes and m edges. Print the number of connected components. Input format: First line: n and m. Next m lines: u v. Output format: Print the component count. Constraints: 1 <= n <= 3817; 0 <= m <= 7634; 1 <= u,v <= n.
Example 1:
Example 2:
Example 3:
Constraints:
1 <= n <= 3817; 0 <= m <= 7634; 1 <= u,v <= n.
