General graph matching

Given an undirected graph with N vertices and M edges, print the size of a maximum matching.

Hard9GraphGreedyBacktrackingImplementationNo attempts yetTime limit1sMemory limit128 MB

Problem

A graph with NN vertices and MM undirected edges is given. Write a program that prints the size of a maximum matching of that graph.

In a graph G=(V,E)G = (V, E) (V=N|V| = N, E=M|E| = M), a matching TT is a subset of EE in which no two elements share a vertex.

A maximum matching is a matching of the largest possible size.

Input

The first line contains the number of vertices NN (1N5001 \le N \le 500) and the number of edges MM (1M1247501 \le M \le 124750).

Each of the next MM lines describes one edge.

An edge is described by the numbers of the two distinct vertices it joins.

Every vertex number is a natural number between 11 and NN.

At most one edge joins any given pair of vertices.

Output

Print the size of a maximum matching on the first line.