import Control.Monad
import qualified Data.Set as S
import qualified Data.ByteString.Char8 as BS
main=do
  [n,m]<-map read.words<$>getLine
  edge<-replicateM m (BS.words<$>BS.getLine)
  print(f m edge edge)
   where f 0 _ _ = 0
         f m ([a,b]:ab) edge = (g b edge (h [a,b] edge [] S.empty))+(f (m-1) ab edge)
         h [a,_] [] l s = (l,S.insert a s)
         h [a,b] ([x,y]:edge) l s |[a,b]==[x,y] = h [a,b] edge l s
                                  |a==x         = h [a,b] edge (y:l) (S.insert y s)
                                  |a==y         = h [a,b] edge (x:l) (S.insert x s)
                                  |otherwise    = h [a,b] edge l s
         g _ _ ([],_) = 1
         g b edge ((v:l),s) |b==v = 0
                            |otherwise = g b edge (i v edge l s)
         i _ [] l s = (l,s)
         i v ([x,y]:edge) l s |v==x&&(not (S.member y s)) = i v edge (y:l) (S.insert y s)
                              |v==y&&(not (S.member x s)) = i v edge (x:l) (S.insert x s)
                              |otherwise = i v edge l s