The directed graph is given. How many pairs of vertices have a common ancestor? The common ancestor of vertices and is a vertex for which and are reachable from .
The first line contains integers and m~(1 \le n \le 10^4, 0 \le m \le 10^4) — the number of vertices and edges in the graph. Each of the next lines contains two numbers from to . The pair means that an edge goes from to .
Print one number — the number of pairs.

Esempio 1
Esempio 2