Cable TV Network

Time limit5sMemory limit128 MB

Problem

In a cable TV network the interconnection of the relays is bi-directional. The network is connected if there is at least one interconnection path between every pair of relays present in the network; otherwise it is disconnected. An empty network, or a network with a single relay, is considered connected.

The safety factor $f$ of a network with $n$ relays is defined as follows:

  1. $f = n$, if the network stays connected no matter how many relays are removed from it.
  2. Otherwise, the minimum number of relays whose removal disconnects the network.

Figure 1. Cable TV networks

For example, consider the networks in Figure 1, where the circles mark the relays and the solid lines are interconnection cables. Network (a) stays connected regardless of how many relays are removed, so by rule (1) $f = n = 3$. Network (b) is already disconnected when $0$ relays are removed, hence $f = 0$ by rule (2). Network (c) becomes disconnected when relays 1 and 2, or 1 and 3, are removed, so its safety factor is 2.

Write a program that reads several data sets and computes the safety factor of the cable network encoded by each data set.

Input

Each data set starts with two integers: the number of relays $n$ ($0 \le n \le 50$), and the number of cables $m$. Then follow $m$ data pairs $(u, v)$ with $u < v$, where $u$ and $v$ are relay identifiers (integers in the range $0 \dots n-1$). The pair $(u, v)$ designates the cable that interconnects relays $u$ and $v$. The pairs may occur in any order. Except inside the $(u, v)$ pairs, which contain no white space, white space may occur freely in the input. The input terminates at end of file and is always correct.

Output

For each data set, print on standard output, starting at the beginning of a line, the safety factor of the encoded network.