Under construction

Still being built. Things may change

Bridges

Interview

Time limit2sMemory limit1024 MB

Summary
Given a connected graph, find the fewest extra edges needed so that no edge is a bridge anymore.
Level

Medium6 of 10

Topics
Graph, DFS, Tree
Solved
No attempts yet

Problem

King Julian rules over nn islands, numbered from 1 to nn. Some pairs of islands are connected by bridges that can be crossed in both directions. There are mm bridges in total. Any island can be reached from any other island by moving across the bridges.

A bridge is critical if, when it collapses, there exist two islands such that one cannot be reached from the other using the remaining bridges.

King Julian is worried about the safety and reliability of communication in his realm. He wants to build additional bridges between some pairs of islands so that no critical bridge remains. Since he is also thrifty, he wants to find the minimum number of additional bridges needed to meet this requirement.

Input

The first line contains two integers nn and mm, the number of islands and the number of bridges (2≤n≤1000002 \le n \le 100000, 1≤m≤2000001 \le m \le 200000). Each of the next mm lines contains two integers aia_i and bib_i, the islands connected by the ii-th bridge (1≤ai,bi≤n1 \le a_i, b_i \le n, ai≠bia_i \neq b_i).

It is guaranteed that any island can be reached from any other island by moving across the bridges.

Output

Print one integer: the minimum number of additional bridges that must be built so that no critical bridges remain.

Examples2

  1. Example 1

    Input
    5 5
    1 2
    2 3
    2 4
    2 5
    4 5
    
    Expected output
    1
    
  2. Example 2

    Input
    2 1
    1 2
    
    Expected output
    1