#d1805. Cow and Snacks

Cow and Snacks

Cow and Snacks

Problem Description

The farm is hosting a party!

There are nn kinds of snacks, numbered from 11, each snack having exactly one portion. There are mm guests coming, and each guest has two favorite flavors.

The farmer can arrange the guests to come in some order, one by one.

When a guest arrives, he eats all the snacks of his favorite flavors. If there is none of his favorite flavor left, he leaves sadly.

How should the guests be ordered so that the number of sad guests is minimized? Output the minimum possible number of sad guests.

Input Format

The first line contains two integers n,mn, m (2≤n≤1052 \le n \le 10^5, 1≤m≤1051 \le m \le 10^5), the number of snacks and the number of guests respectively.

Each of the next mm lines contains two integers xi,yix_i, y_i (1≤xi,yi≤n1 \le x_i, y_i \le n, xi≠yix_i \neq y_i), the numbers of the two favorite snacks of guest ii.

Output Format

Output one integer: the minimum number of sad guests.

Sample Input 1

5 4
1 2
4 3
1 4
3 4

Sample Output 1

1

Sample Input 2

6 5
2 3
2 1
3 4
6 5
4 5

Sample Output 2

0

Sample Explanation

In the first sample, the guests can be ordered as 3,1,2,43, 1, 2, 4. Guest 33 eats snacks 11 and 44; then guest 11 eats snack 22; guest 22 eats snack 33; guest 44 finds no favorite snack left and leaves sadly, so the answer is 11.

In the second sample, ordering the guests as 2,1,3,5,42, 1, 3, 5, 4 makes no guest sad.