Under construction

Still being built. Things may change

Königsberg Bridges

Time limit3sMemory limit512 MB

Summary
Given a graph, add edges so that a simple path passes through every bridge, and find the maximum number of bridges possible.
Level

Medium7 of 10

Topics
Graph, DFS, Tree
Solved
No attempts yet

Problem

Given a graph, we say it is Königsbergsy if there is a simple path that goes through all of its bridges. Here, a bridge is an edge that disconnects the graph when removed. A simple path is a path that visits each vertex at most once.

Given a graph GG, add some edges to it to make it Königsbergsy. You may add more than one edge between the same pair of vertices. Determine the maximum number of bridges that the resulting graph can have.

Input

The first line contains two integers nn and mm (2≤n≤1062 \leq n \leq 10^6; 0≤m≤1060 \leq m \leq 10^6), the number of vertices and the number of edges of GG.

Each of the next mm lines contains two integers uiu_i, viv_i (0≤ui,vi≤n−10 \leq u_i, v_i \leq n-1), describing an edge between vertices uiu_i and viv_i.

Output

Output one integer, the maximum number of bridges the resulting graph can have.

Examples2

  1. Example 1

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

    Input
    4 2
    0 1
    1 2
    
    Expected output
    3