eolymp
bolt
Try our new interface for solving problems
Problems

Covering with paths

Covering with paths

Time limit 1 second
Memory limit 128 MiB

An oriented acyclic graph is given. Find the minimum number of disjoint paths covering all vertices.

Input data

First line contains number of vertices n and number of edges m (2n1000, 0m10^5). Each of the next m lines contains two numbers: the numbers of the vertces u and v connected with an edge (u, v).

Output data

Print the minimum number of paths that can cover all the vertices.

Examples

Input example #1
3 3
1 3
3 2
1 2
Output example #1
1
Author Антон Банных