A country has n villages, numbered 0 to n - 1. You are given the list edges. An entry edges[i] = [a_i, b_i] means there is a road between villages a_i and b_i, and you can drive it either way.
Two villages are in the same group if you can drive from one to the other, maybe through other villages. A village with no road is a group by itself.
Return how many groups there are.
Examples
Example 1:
Input: n = 6, edges = [[0,1],[2,3],[3,4]]
Output: 3
Explanation: The groups are {0, 1}, {2, 3, 4} and {5}.
Example 2:
Input: n = 4, edges = [[0,1],[1,2],[2,3]]
Output: 1
Explanation: The roads link all villages in one chain.
Example 3:
Input: n = 5, edges = [[0,4],[1,3]]
Output: 3
Explanation: The groups are {0, 4}, {1, 3} and {2}.