// use std::ops::{Index, IndexMut};
// use std::cmp::{Ordering, min, max};
// use std::collections::{BinaryHeap, BTreeMap};
// use std::collections::btree_map::Entry::{Occupied, Vacant};
// use std::clone::Clone;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*) 
        }
    };
}

macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iter = s.trim().split(' ');
            iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

macro_rules! mvec {
    ($v: expr, $s: expr) => {
        vec![$v; $s]
    };
    ($v: expr, $s: expr, $($t: expr),*) => {
        vec![mvec!($v, $($t),*); $s]
    };
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn printiter<'a, T>(v: &'a T)
where
    &'a T: std::iter::IntoIterator, 
    <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}

type Cost = i64;

#[derive(Clone)]
struct Edge {
    to: usize,
    cost: Cost,
}

impl std::cmp::Ord for Edge {
    fn cmp(&self, other: &Edge) -> std::cmp::Ordering {
        (-self.cost).cmp(&(-other.cost))
    }
}

impl PartialOrd for Edge {
    fn partial_cmp(&self, other: &Edge) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}

impl Eq for Edge {}

impl PartialEq for Edge {
    fn eq(&self, other: &Edge) -> bool {
        self.cost == other.cost
    }
}

#[derive(Clone)]
struct Graph {
    adj: Vec<Vec<Edge>>,
}

impl std::ops::Index<usize> for Graph {
    type Output = Vec<Edge>;

    fn index(&self, i: usize) -> &Vec<Edge> {
        &self.adj[i]
    }
}

impl std::ops::IndexMut<usize> for Graph {
    fn index_mut<'a>(&'a mut self, i: usize) -> &'a mut Vec<Edge> {
        &mut self.adj[i]
    }
}

impl Graph {

    fn new(n: usize) -> Graph{
        Graph {
            adj: vec![vec![]; n],
        }
    }

    fn size(&self) -> usize{
        self.adj.capacity()
    }

    fn add_edge(&mut self, from: usize, to_: usize, cost_: Cost) {
        self.adj[from].push(Edge{to: to_, cost: cost_});
    }

    fn add_uedge(&mut self, from: usize, to_: usize, cost_: Cost) {
        self.add_edge(from, to_, cost_);
        self.add_edge(to_, from, cost_);
    }

    fn dfs(&self, p: usize, used: &mut Vec<bool>) -> usize {
        if used[p] {
            0
        } else {
            used[p] = true;
            let mut res = 1;
            for e in &self[p] {
                res += self.dfs(e.to, used);
            }
            res
        }
    }
}


fn main() {
    let (n, m) = readl!(usize, usize);
    let mut g = Graph::new(n);
    for _ in 0..m {
        let (a, b) = readl!(usize, usize);
        g.add_uedge(a-1, b-1, -1);
    }
    let mut ans = 0;
    for p in 0..n {
        for e in &g[p] {
            let mut used = vec![false; n];
            used[p] = true;
            let res1 = g.dfs(e.to, &mut used);
            used = vec![false; n];
            used[e.to] = true;
            let res2 = g.dfs(p, &mut used);
            // debug!(res1); debug!(res2);
            if res1 + res2 == n {
                ans += 1;
            }
        }
    }
    println!("{}", ans/2);
}



Measured memory_bytes: 4352