This page is still under construction.

Parts of this page are still being built. What you see may change.

Bus Lines

Time limit1sMemory limit128 MB

Summary
Partition the edges of a connected undirected graph into the fewest trails, where a trail may revisit cities but not edges.
Level

Medium7 of 10

Topics
Graph, Greedy, Math
Solved
No attempts yet

Problem

In Byteotia there are nn cities connected by two-way roads, with many villages lying along those roads. King Byteasar has decided to create a network of bus lines serving the cities and villages. Each line may start and end in any city and may pass through any cities. A line may visit the same city more than once. However, no line may travel along the same road more than once.

To provide transport for all residents while keeping the investment cost as low as possible, the king decided that every road must be covered by exactly one bus line, and that the number of bus lines must be as small as possible.

In other words, partition all roads into a set of lines so that each road belongs to exactly one line, and make the number of lines as small as possible. A single line is a walk that never repeats a road (a trail); it may pass through the same city several times.

Input

The first line contains two integers nn and mm separated by a single space (2≤n≤100002 \le n \le 10000, n−1≤m≤200000n - 1 \le m \le 200000), where nn is the number of cities and mm is the number of roads. Cities are numbered from 11 to nn. Each of the next mm lines describes one road and contains two integers aa and bb separated by a single space (1≤a<b≤n1 \le a < b \le n), the numbers of the two cities connected by that road. Each road appears in the input exactly once. Any two cities are directly connected by at most one road (although there may be many routes between two cities), and it is possible to travel between any two cities along the roads (the graph is connected).

Output

Output a single line containing one integer cc, the minimum number of bus lines needed.

Hint

Examples3

  1. Example 1

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

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

    Input
    3 3
    1 2
    1 3
    2 3
    
    Expected output
    1