ADACHERY - Ada and Cherry
As you might already know, Ada the Ladybug is a farmer. She grows cherry and now she wants to collect them. She is wondering about the number of cherries she will collect. But befor you could help here, you shall know some biological facts:
Firstly, almost everyone think that cherry-tree is a tree. But it might not be true - in fact, it is a graph.
Secondly, you have to know, how a cherry looks like. It is not hard to recognize a chery - it is a node, which is connected to another two nodes, which are NOT connected.
NOTE: Even though the cherry-tree structure might be weird, note that there won't be any multi-branches nor self-branches. Anyway do not assume it is not a cherry-forest.
This is a cherry:
This is NOT a cherry:
The first line contains two integers 1 ≤ N, M ≤ 105, the number of nodes of cherry-tree and the number of branches (edges) connecting them.
The next M lines contains two integers 0 ≤ a, b < N, the branch connecting two nodes.
Print a single line - the number of cherries on the cherry-tree.
4 2 1 2 3 2
Example Input 2
5 4 1 2 1 3 1 4 1 0
Example Output 2
Example Input 3
6 6 0 1 0 2 2 1 0 3 1 4 5 3
Example Output 3
Can somebody please explain how the example output 3 is 5.