C. Construction Company
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

There are $$$n$$$ cities arranged on the border of a circle in cyclic order from $$$1$$$ to $$$n$$$. Neighboring cities are connected by a street; that is, for each $$$i$$$ from $$$1$$$ to $$$n-1$$$, $$$i$$$ is connected with $$$i+1$$$, and there is a street connecting $$$1$$$ and $$$n$$$. There are also $$$m$$$ additional streets connecting two cities in a straight line. No two streets intersect outside the cities.

Due to previous mismanagement of funds, all streets are in dire need of repairs. You are to hire some construction companies to repair every street.

You can hire a construction company to repair a subset of all streets. Each construction company has certain conditions for the streets they repair. Suppose there are two cities $$$u$$$ and $$$v$$$ that are endpoints of (possibly different) streets they repair. Then, if there is a street connecting $$$u$$$ and $$$v$$$, they also need to be hired to repair this street $$$uv$$$. Furthermore, there must not be any cycle in the streets they repair, as workers may get lost and keep repairing the same streets. Note that the streets one construction company repairs do not have to be connected.

As you should not waste any money, no street should be repaired more than once. How many construction companies do you have to hire at least?

Input

The input consists of:

  • One line with two integers $$$n$$$ and $$$m$$$ ($$$3 \leq n \leq 2 \cdot 10^5$$$, $$$0 \leq m \leq n-3$$$), the number of cities and the number of additional streets.
  • $$$m$$$ lines with two integers $$$u$$$ and $$$v$$$ ($$$1 \leq u, v \leq n, u \neq v$$$), indicating a street between cities $$$u$$$ and $$$v$$$.

No two streets connect the same pair of cities.

Output

Output one integer, the minimum number of construction companies you have to hire.

Examples
Input
6 1
5 2
Output
2
Input
3 0
Output
3
Input
10 3
1 4
4 9
4 7
Output
2
Note

Consider the first sample. The following picture visualizes the input and shows a valid way to assign streets to companies (company 1 is red and company 2 is blue).

Thus, two companies are sufficient. It can be shown that one company is not sufficient.

The following picture shows an invalid way to assign companies:

This is invalid because cities $$$1$$$ and $$$6$$$ are endpoints of streets which are assigned to company 1 (red). Thus, the street between $$$1$$$ and $$$6$$$ also needs to be assigned to company 1, but it is assigned to company 2 (blue).