eolymp
bolt
Try our new interface for solving problems
Problems

Chain repairing

Chain repairing

Sovunya had a chain consisting of n links, numbered from 1 to n. But while the chain was lying in the chest of drawers, it was all tangled. Sovunya wants to rectify the situation.

Each link is a ring of wire. Every two links are either linked to each other or not. Sovunya turned to Pin for help. He can do two things:

  • Unforge one of the links. At the same time, it ceases to be a closed ring, and therefore it can be disconnected from all other links.
  • Resolder the previously unforged link. In this case, it becomes a closed ring again. Pin can choose an arbitrary set of other links, thread the current link through them before sealing, and thus chain this link to each link from the selected set.

At the end, all links must be soldered.

Sovunya wants link number 1 to be linked with link number 2, 2 with 3, . . . , n - 1 with n. In other words, links with numbers i and i + 1 must be linked for all i ∈ [1, n - 1]. And no other pairs of links should be linked.

Help Pin determine the minimum number of steps he have to perform to fix the chain.

Input

The first line contains two integers n and m (1n40, 0m ≤ * n* * (n - 1) / 2) - the number of links and the number of pairs of initially linked links.

The next m lines contain two integers ai and bi (1ai, bi*n *, aibi) - numbers of linked links.

It is guaranteed that each unordered pair of links occurs at most once in the input.

Output

Print one integer - the minimum number of actions that Pin must do to fix the chain.

Note

In the first example Pin can unforge link number 3. Then it will detach from both remaining links. And then, solder link number 3 back, coupling it only with link number 2.

In the second example, Pin can unforge link number 2, then solder it back by connecting it to links 1 and 3. And then, unforge link number 4 and solder back, connecting with links 3 and 5.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 3
1 2
2 3
3 1
Output example #1
2
Input example #2
5 0
Output example #2
4
Input example #3
1 0
Output example #3
0
Source 2020 Cycle of Internet Olympiads for schoolchildren, First team contest, October 18, Problem D