CodeLab Academy 📞 9936 6696
← List Python · Level 10: Algorithms Code · 100 points ← #960 #962 →

#961. Connected components

You get a graph with n vertices and m undirected edges. Count its connected components. ### Input n m, then m lines `u v`. ### Output A number.

Examples

Input
5 1
4 5
Output
4
Input
1 1
1 1
Output
1

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!