Scanf.scanf "%d %d" (fun n m ->
    let ab = Array.init m (fun _ -> Scanf.scanf " %d %d" (fun a b -> a, b)) in
    let rec loop exc acc =
        if exc = m then acc else (
            let par = Array.init n (fun i -> i) in
            let rec root x =
                if par.(x) = x then x else
                    let r = root par.(x) in
                    let () = par.(x) <- r in
                    r
            in
            let merge a b =
                if root a <> root b then par.(par.(b)) <- par.(a)
            in
            Array.iteri (fun i (a, b) -> if i <> exc then merge (a - 1) (b - 1)) ab;
            let rec loop2 i prev =
                if i = n then true else
                    if root i <> prev then false else loop2 (i + 1) prev
            in
            let acc = if loop2 1 (root 0) then acc else acc + 1 in
            loop (exc + 1) acc
        )
    in
    loop 0 0 |> Printf.printf "%d\n"
)