{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as MV
import           Control.Monad.ST

parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
readIntegerList = map parseInteger . BS.words <$> BS.getLine

res = 1000000000 + 7

main = do
  [n, m] <- readIntList
  con    <- concat <$> replicateM
    m
    ((\[a, b] -> [(a - 1, b - 1), (b - 1, a - 1)]) <$> readIntList)
  let matrix     = createMatrix n con
      perm       = map (0:) $ permutations [1 .. (n - 1)]
      validPaths = filter (judge matrix) perm
  print . length $ validPaths

judge matrix (a : b : rest) = ((matrix V.! a) V.! b) && judge matrix (b : rest)
judge matrix _ = True

type AdjacencyMatrix = V.Vector (V.Vector Bool)
createMatrix :: Int -> [(Int, Int)] -> AdjacencyMatrix
createMatrix n con =
  V.fromList
    $ map
        (\conByStart -> V.create $ do
          adj <- MV.replicate n False
          forM_ conByStart (\(i, j) -> MV.write adj j True)
          return adj
        )
    . groupBy (\a b -> fst a == fst b)
    . sort
    $ con
