Kanan is a girl who loves to study.
Today, she attended a course called Set Theory and Graph Theory, where she learned the concept of a "simple cycle":
In a directed graph $G=\langle V,E \rangle$, a simple cycle is a sequence of vertices $a_1 \dots a_n (a_i \in V)$ that satisfies:
- $a_1$ is the smallest vertex in the cycle, i.e., $\forall 1 \leq i \leq n$, $a_1 \leq a_i$. This is to avoid counting the same cycle multiple times.
- The $a_i$ are all distinct, i.e., $\forall 1 \leq i < j \leq n$, $a_i \neq a_j$.
- The $a_i$ form a cycle, i.e., $\forall 1 \leq i < n$, $(a_i,a_{i+1}) \in E$, and $(a_n,a_1) \in E$.
Furthermore, we define that a cycle $a_1 \dots a_n$ passes through an edge $(u,v)$ if and only if $\exists i \in [1,n)$ such that $a_i=u, a_{i+1}=v$, or $a_n=u, a_1=v$.
Two cycles are different if and only if their corresponding sequences of vertices are different.
After fully understanding the concept of a simple cycle, Kanan created a simple exercise:
Given a directed graph $G$, let there be $p$ cycles $c_i$ in $G$. Construct an undirected graph $G'$ as follows:
- $G'$ has $p$ vertices, each corresponding to one of the $c_i$. Note that in this problem, the correspondence can be arbitrary, as it does not affect the answer.
- An edge exists between vertex $i$ and vertex $j$ if and only if their corresponding cycles share at least one common edge.
The figure below shows an example. The left graph is a directed graph with $4$ vertices, which has three cycles $(1,2,3), (2,3,4)$, and $(1,2,3,4)$. Its corresponding $G'$ is shown on the right:
This problem is too difficult for Kanan, but she believes it must be solvable, so she included it in this competition, hoping you can help her solve it xD.
Input
The first line contains two positive integers $n$ and $m$, representing the number of vertices and edges in $G$.
The next $m$ lines each contain two integers $u_i, v_i (1 \leq u_i, v_i \leq n)$, representing a directed edge in the graph.
It is guaranteed that there are no multiple edges or self-loops in the graph. Note that there may be two directed edges between a pair of vertices, one in each direction.
Output
Output a single integer representing the answer, which is the number of connected components in $G'$.
Examples
Input 1
4 6 1 2 2 3 3 4 4 1 3 1 4 2
Output 1
1
Input 2
6 9 1 2 2 3 3 4 4 2 3 1 4 5 3 6 5 6 6 5
Output 2
2
Subtasks
This problem is divided into $3$ subtasks. You must pass all test cases in a subtask to receive the points for that subtask:
Subtask 1 ($21$ points): $n \leq 10, m \leq 50$.
Subtask 2 ($46$ points): $n \leq 5000, m \leq 10^4$.
Subtask 3 ($33$ points): $n \leq 10^5, m \leq 2 \times 10^5$.