Problem Statement

You have N light bulbs, however they are currently jumbled up in wires. When you start unravelling the bulbs, you observe that the situation can be described by a directed acyclic graph connecting the bulbs to each other.

Formally, you are given a directed graph consisting of N nodes (numbered 1 to N) and M edges such that it contains no cycles. A sequence of vertices (v1, v2, … vk) is called a path if there exists an edge from vi to vi+1 for every i such that 1 ≤ i ≤ k-1. A path (v1, v2, … vk) in the graph is called maximal, if for any vertex v, the sequence (v, v1, v2, … vk) or (v1, v2, … vk, v) do not represent paths in the graph.

Find the number of maximal paths in the graph.

Input

The first line contains two integers N and M.

The next M lines each contain two integers u and v – representing an edge from vertex u to vertex v.

Constraints:

1 ≤ N ≤ 105

0 ≤ M ≤ 2×105

1 ≤ u, v ≤ N

The graph does not contain any self-loops or multiple edges.

Output

Print a single integer – the number of maximal paths.

Example

Sample Input 1:

3 1

1 2

Sample Output 1:

2

Sample Explanation 1:

The two maximal paths are (1, 2) and (3).

Sample Input 2:

3 3

1 2

2 3

1 3

Sample Output 2:

2

Sample Explanation 1:

The two maximal paths are (1, 2, 3) and (1, 3).

Sample Input 3:

3 2

1 3

3 2

Sample Output 3:

1

Sample Explanation 3:

The only maximal path is (1, 3, 2).