#P1302B. DAG
DAG
Description
This is an unusual problem in an unusual contest, here is the announcement: http://codeforces.com/blog/entry/73543
You are given a directed acyclic graph with vertices and edges. Denote by the set of all vertices reachable from by moving along the edges of . Find .
The first line contains two integers () denoting the number of vertices and the number of edges of .
Each of the next lines contains two integers (), denoting the edge from to .
It's guaranteed that the given graph does not contain any cycles.
Print one integer — the answer to the problem.
Input
The first line contains two integers () denoting the number of vertices and the number of edges of .
Each of the next lines contains two integers (), denoting the edge from to .
It's guaranteed that the given graph does not contain any cycles.
Output
Print one integer — the answer to the problem.