# Condensation of the graph

# Condensation of the graph

Find the number of edges in the condensation of a given directed graph.

The condensation of a directed graph **G** is a directed graph **G**', whose vertices are strongly connected components of **G**, and the edge in **G**' is present only if there exists at least one edge between the vertices of corresponding connected components.

The graph condensation does not contain multiple edges.

#### Input

The first line contains two positive integers **n** and **m** (**n** ≤ **10000**, **m** ≤ **100000**) - the number of vertices and edges in a graph correspondingly. Each of the next **m** lines describes the edge of the graph. The edge number **i** is given with two positive integers `b`

, _{i}`e`

(_{i}**1** ≤ `b`

, _{i}`e`

≤ _{i}**n**) - the beginning and finishing vertex of the graph. The input graph may contain the multiple edges and loops.

#### Output

The number of edges in graph condensation.

4 4 2 1 3 2 2 3 4 3

2