Find the number of connected components in an undirected graph with n nodes and given edges.
Given n nodes (0 to n-1) and a list of undirected edges, find the number of connected components in the graph.
A connected component is a maximal set of vertices where every vertex is reachable from every other vertex in the set.