Matches
Anton has invented a new team sport called waterball (similar to paintball, but with water). He wants to share his invention with his friends. Anton has good relationships with all his friends, but it's not guaranteed that his friends have the same relationships with each other. Specifically, we know that friend number conflicts with friend .
Anton was given a list of conflicting pairs (). Now, it seems like it would be possible to divide the players into two teams, but it's not that simple for Anton...
He wants to divide these conflicting pairs into segments in such a way that:
each conflicting pair belongs to exactly one segment;
considering only the relationships within each segment, it should be possible to divide all the people into two teams in such a way that there are no two conflicting people in the same team.
For example, let's say we have an array of conflicting pairs . We can take the first two pairs in the first segment. In this case, we can form the teams: and . In the second segment, we can take the last pair. and must be in different teams, and can be in either team. Alternatively, we can assign the first pair to the first segment, and the last two to the second segment. Note that we cannot assign the first and third pairs to the same segment, and the second pair to another. This is because a segment should only contain consecutive pairs. We also cannot assign all pairs to the same segment, as there would always be a team where people conflict.
Anton has made the statement complicated again, and now he can't solve the problem. Help him by telling him the minimum number of segments into which he can divide the pairs to satisfy the above conditions.
Input
The first line contains two integers , () — the number of friends and the number of conflicting relationships among friends.
The next lines contain two integers each, , (, ), indicating that friend conflicts with friend .
It is guaranteed that no pair () is repeated more than once.
Output
Print a single integer — the answer to the problem.
Examples
Note
The first example is explained in the legend above.
In the second example, for instance, it is possible to divide into the following segments: , , .
In the first segment, the teams can be formed as , — and do not conflict with each other, as well as the pairs , , .
In the second segment, the teams can be formed as , — and do not conflict with each other, as well as the pairs , , .
In the third segment, the teams can be formed as , — and do not conflict with each other, as well as the pairs , , .
Scoring
( points): ;
( points): ;
( points): ;
( points): conflicting pairs in the input are randomly generated; this means that pairs were randomly selected from all pairs;
( points): each person conflicts with no more than people;
( points): ;
( points): ;
( points): without additional restrictions.