Lizard Tom is tired of his boring life. He really wants to go out and play with his friends!
Cabi says he will take a group to the Coffee Club to drink lots of coffee and stay up all night. That sounds super fun! Money says he will drive everyone to get midnight snacks. Even though Tom just ate 75 buckets of popcorn, who can say no to food? A RedCapeFlyingCat wants to study together for homework, because a mean TA made a problem about "Ryuo or something", and he has been stuck on it for two hours already.
Huh... Down time certain!
Only poor CS students do their I2P homework—Tom is a happy lizard !
Anyway, too many friends are inviting Tom. Tom cannot even tell if friend A and friend B are actually planning the same party! So, he wants you to write a program to count how many different groups of friends are inviting him out.
Tom has friends, numbered from to . You are given plans. Each plan has two numbers and , meaning friend and friend will hang out together, so they are in the same group.
If anyone in group hangs out with anyone in group , group and group will merge into one single group (in other words, each group is a connected component). Any friend who has no plans with anyone is simply in their own group of size 1.
Print one integer: the total number of friend groups -- You'd better finish quickly while Tom is still doing his wiggle dance, or he will start guessing the answer from 1 once again !
The first line contains two integers and — the number of friends and the number of plans.
The next lines each contain two integers and , meaning friend and friend are hanging out together.
It is guaranteed that there are no self-loops () and no duplicate plans.
Print a single integer — the total number of friend groups.