Three lessons from this problem:
Not all graph connectivity problems need MST. Sometimes counting components is enough
Sometimes you need to count and connect components without considering weights
Union-Find is useful for component problems beyond MST If you solved this, you understand how to use Union-Find beyond MST algorithms. This skill appears in many graph problems. Component detection and merging is a core graph technique.