This page is still under construction.

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

Group Project

Time limit2sMemory limit512 MB

Summary
Given a conflict graph guaranteed to be bipartite, find the maximum number of disjoint pairs of students that contain no conflicting pair.
Level

Medium7 of 10

Topics
Graph, Greedy, Math, Combinatorics
Solved
No attempts yet

Problem

The big day has finally arrived: today you are going to form groups of two in which you will do the end-of-the-year project. When you arrive at school, you learn that the teacher of the other class is sick, and that your teacher, Mr. B.A.P. Cee, will also have to make groups for the other class. Mr. B.A.P. Cee is a smart guy and realizes that he can use these unfortunate circumstances to his advantage.

Ending up with groups of one should be avoided at all cost, so mixing the students of the two classes may avoid this situation. However, while it is easy to pair up two students from the same class, it is more difficult to match up students from different classes. Throughout the years there has been a lot of rivalry between the two groups, and many students dislike students in the other class. Mr. B.A.P. Cee knows which pairs of students will result in a fight and a failed project.

You are given a list of pairs of students who cannot work together. How many disjoint groups of two can Mr. B.A.P. Cee make that will not result in a failed project?

Input

The input consists of:

  • A line with two integers nn (1≤n≤1051 \leq n \leq 10^5), the number of students, and mm (0≤m≤2⋅105{0\leq m\leq 2\cdot10^5}), the number of pairs of students who cannot work together.
  • mm lines, each with two distinct integers ii and jj (1≤i,j≤n1\leq i, j\leq n, i≠ji \neq j), giving a pair of students who cannot work together.

Students are identified by the numbers 11 through nn. It is guaranteed that it is possible to split the students into two classes in such a way that all students from the same class get along.

Output

Output the number of pairs of students Mr. B.A.P. Cee can make without making any pair of students who cannot work together.

Examples3

  1. Example 1

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

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

    Input
    6 6
    1 4
    2 5
    3 6
    1 5
    3 5
    2 6
    
    Expected output
    3